|
|
@ -1,6 +1,7 @@ |
|
|
|
#include "mainMenu.h" |
|
|
|
#include"mainMenu.h" |
|
|
|
#include"createCustomer.c" |
|
|
|
|
|
|
|
|
|
|
|
bool agePermission(int age) |
|
|
|
{ |
|
|
|
|
|
|
@ -24,13 +25,14 @@ bool checkIfInteger(char* userInput) |
|
|
|
bool chooseOption(int choiceInput) |
|
|
|
{ |
|
|
|
|
|
|
|
if(choiceInput < 1 || choiceInput > 4) |
|
|
|
if(choiceInput<1 || choiceInput>4) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -48,6 +50,7 @@ void ageInput() |
|
|
|
scanf("%s",userInput); |
|
|
|
|
|
|
|
int c; |
|
|
|
/*this loop flushes the input buffer for the upcoming getchar*/ |
|
|
|
while ((c = getchar()) != '\n' && c != EOF) {}; |
|
|
|
|
|
|
|
while (true) |
|
|
@ -56,12 +59,13 @@ void ageInput() |
|
|
|
|
|
|
|
if((checkIfInteger(userInput))&& (agePermission(age))) |
|
|
|
{ |
|
|
|
age = strtol(userInput,&userInputPointer,10); |
|
|
|
|
|
|
|
//printf("Access granted!\n\n\n\n"); |
|
|
|
collectCustomerProperties(); |
|
|
|
printf("Access granted!\n\n\n\n"); |
|
|
|
|
|
|
|
showMenu(); |
|
|
|
|
|
|
|
menuInput(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
@ -86,6 +90,59 @@ void ageInput() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void menuInput() |
|
|
|
{ |
|
|
|
|
|
|
|
char choiceInput[20]; |
|
|
|
|
|
|
|
char* choiceInputPointer; |
|
|
|
|
|
|
|
int selection; |
|
|
|
|
|
|
|
int c; |
|
|
|
scanf("%s",choiceInput); |
|
|
|
/*this loop flushes the input buffer for the upcoming getchar*/ |
|
|
|
while ((c = getchar()) != '\n' && c != EOF) {}; |
|
|
|
|
|
|
|
while(true) |
|
|
|
{ |
|
|
|
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 : collectCustomerProperties(); |
|
|
|
break; |
|
|
|
|
|
|
|
case 3 : printf("\nLoginAsEmployee() function will be implemented here soon\n\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 4 : printf("\e[1;1H\e[2J"); |
|
|
|
|
|
|
|
printf("\nsee you next time !\n\n"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
printf("Input invalid! try again!\n"); |
|
|
|
|
|
|
|
scanf("%s",choiceInput); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void showMenu() |
|
|
|
{ |
|
|
@ -100,4 +157,3 @@ void showMenu() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|