|
@ -24,15 +24,7 @@ bool checkIfInteger(char* userInput) |
|
|
bool chooseOption(int choiceInput) |
|
|
bool chooseOption(int choiceInput) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if(choiceInput < 1 || choiceInput > 4) |
|
|
|
|
|
{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return !(choiceInput < 1 || choiceInput > 4); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -50,6 +42,8 @@ void ageInput() |
|
|
|
|
|
|
|
|
while (true) |
|
|
while (true) |
|
|
{ |
|
|
{ |
|
|
|
|
|
/*the userInput string is changed to a number with the strtol function*/ |
|
|
|
|
|
|
|
|
age = strtol(userInput,&userInputPointer,10); |
|
|
age = strtol(userInput,&userInputPointer,10); |
|
|
|
|
|
|
|
|
if((checkIfInteger(userInput))&& (agePermission(age))) |
|
|
if((checkIfInteger(userInput))&& (agePermission(age))) |
|
@ -85,56 +79,40 @@ void ageInput() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void menuInput() |
|
|
void menuInput() |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
char choiceInput[20]; |
|
|
char choiceInput[20]; |
|
|
|
|
|
|
|
|
char* choiceInputPointer; |
|
|
char* choiceInputPointer; |
|
|
|
|
|
|
|
|
int selection; |
|
|
int selection; |
|
|
|
|
|
|
|
|
scanf("%s",choiceInput); |
|
|
|
|
|
|
|
|
scanf("%s", choiceInput); |
|
|
|
|
|
selection = strtol(choiceInput, &choiceInputPointer, 10); |
|
|
|
|
|
|
|
|
while(true) |
|
|
|
|
|
|
|
|
while (!checkIfInteger(choiceInput) || !chooseOption(selection)) |
|
|
{ |
|
|
{ |
|
|
selection = strtol(choiceInput,&choiceInputPointer,10); |
|
|
|
|
|
|
|
|
|
|
|
if(chooseOption(selection) == true && checkIfInteger(choiceInput) == true) |
|
|
|
|
|
{ |
|
|
|
|
|
switch(selection) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
case 1 : printf("\nLoginAsCostumer() function will be implemented here soon\n\n"); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 2 : printf("\ncreateCostumerAccount() function will be implemented here soon\n\n"); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n"); |
|
|
|
|
|
|
|
|
printf("Input invalid! try again!\n"); |
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
scanf("%s", choiceInput); |
|
|
|
|
|
|
|
|
case 4 : printf("\e[1;1H\e[2J"); |
|
|
|
|
|
|
|
|
selection = strtol(choiceInput, &choiceInputPointer, 10); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
printf("\nsee you next time !\n\n"); |
|
|
|
|
|
|
|
|
switch(selection) |
|
|
|
|
|
{ |
|
|
|
|
|
case 1 : printf("\nLoginAsCostumer() function will be implemented here soon\n\n"); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
case 2 : printf("\ncreateCostumerAccount() function will be implemented here soon\n\n"); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n"); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
printf("Input invalid! try again!\n"); |
|
|
|
|
|
|
|
|
|
|
|
scanf("%s",choiceInput); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
case 4 : printf("\e[1;1H\e[2J"); |
|
|
|
|
|
printf("\nsee you next time !\n\n"); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|