Browse Source

implement the function isValidAdress().

remotes/origin/backup-for-employees-infos-access
fdai7207 2 years ago
parent
commit
9cad95ce80
  1. 35
      src/createEmployeeAccount.c

35
src/createEmployeeAccount.c

@ -80,6 +80,41 @@ bool isValidPhoneNumber(char *phoneNumber)
return true; return true;
} }
bool isValidAdress(char *street,int houseNumber,char* city,int postalCode)
{
int maximalLength = 20;
int minimalLength = 3;
bool validStreet = true;
bool validHouseNumber = true;
bool validCity = true;
bool validpostalCode = true;
if(strlen(street)>20 || strlen(street)<3)
{
validStreet = false;
}
if(strlen(city)>20 || strlen(city)<3)
{
validCity = false;
}
if(houseNumber<1 || houseNumber > 999)
{
validHouseNumber = false;
}
if(postalCode<1000 || postalCode > 99000)
{
validpostalCode = false;
}
if(validStreet && validCity && validHouseNumber && validpostalCode)
{
return true;
}
else
{
return false;
}
}
int StringLengthCounter(char* string) int StringLengthCounter(char* string)
{ {
int characterCounter = 0; int characterCounter = 0;

Loading…
Cancel
Save