Browse Source

improve the quality of life in mainMenu.c

main
fdai7514 2 years ago
parent
commit
41afdef70b
  1. 38
      src/mainMenu.c

38
src/mainMenu.c

@ -66,7 +66,7 @@ void ageInput()
} }
else if((checkIfInteger(userInput)) && !(agePermission(age)))
else if((checkIfInteger(userInput)) && !(agePermission(age)))
{ {
errorMessage(-5); errorMessage(-5);
break; break;
@ -80,8 +80,8 @@ void ageInput()
scanf("%s",userInput); scanf("%s",userInput);
} }
} }
} }
@ -90,16 +90,16 @@ void menuInput()
char choiceInput[20]; char choiceInput[20];
char* choiceInputPointer; char* choiceInputPointer;
int selection, input, ctr = 0; int selection, input, ctr = 0;
while((input=getchar())!='\n'){ while((input=getchar())!='\n'){
choiceInput[ctr] = input; choiceInput[ctr] = input;
++ctr; ++ctr;
} }
choiceInput[ctr] = '\0'; choiceInput[ctr] = '\0';
selection = strtol(choiceInput, &choiceInputPointer, 10);
while (!checkIfInteger(choiceInput) || !chooseOption(selection))
selection = strtol(choiceInput, &choiceInputPointer, 10);
while (!checkIfInteger(choiceInput) || !chooseOption(selection))
{ {
printf("Input invalid! try again!\n"); printf("Input invalid! try again!\n");
ctr = 0; ctr = 0;
@ -110,7 +110,7 @@ void menuInput()
choiceInput[ctr] = '\0'; choiceInput[ctr] = '\0';
selection = strtol(choiceInput, &choiceInputPointer, 10); selection = strtol(choiceInput, &choiceInputPointer, 10);
} }
switch(selection)
switch(selection)
{ {
case 1 : collectCustomerDataForLogin(0); case 1 : collectCustomerDataForLogin(0);
break; break;
@ -121,16 +121,16 @@ void menuInput()
case 3 : getEmployeeAccessCode(); case 3 : getEmployeeAccessCode();
break; break;
case 4 : getNewEmployeeCredentials();
case 4 : getNewEmployeeCredentials();
break; break;
case 5 : displayMenuCalculator('c'); case 5 : displayMenuCalculator('c');
break; break;
case 6 : printf("\e[1;1H\e[2J");
printf("\nsee you next time !\n\n");
case 6 : printf("\e[1;1H\e[2J");
printf("\nsee you next time !\n\n");
break; break;
}
}
} }
@ -139,12 +139,12 @@ void showMenu()
printf("\t\t\t\t\t\t\t Welcome to Bank Manager!"); printf("\t\t\t\t\t\t\t Welcome to Bank Manager!");
printf("\n\n\n\n\t\t\t\t\t\tPlease select one of the following functions!"); printf("\n\n\n\n\t\t\t\t\t\tPlease select one of the following functions!");
printf("\n\n\n\n\t\t\t\t\t\t ->Login as an existing costumer.");
printf("\n\n\t\t\t\t\t\t ->Register as a new costumer.");
printf("\n\n\t\t\t\t\t\t ->Login as an Employee.");
printf("\n\n\t\t\t\t\t\t ->Register as an Employee.");
printf("\n\n\t\t\t\t\t\t ->Calculator");
printf("\n\n\t\t\t\t\t\t\t\t ->Exit.\n");
printf("\n\n\n\n\t\t\t\t\t\t 1->Login as an existing costumer.");
printf("\n\n\t\t\t\t\t\t 2->Register as a new costumer.");
printf("\n\n\t\t\t\t\t\t 3->Login as an Employee.");
printf("\n\n\t\t\t\t\t\t 4->Register as an Employee.");
printf("\n\n\t\t\t\t\t\t 5->Calculator");
printf("\n\n\t\t\t\t\t\t\t\t 6->Exit.\n");
printf("\n\n\n\n\n Selection :\n"); printf("\n\n\n\n\n Selection :\n");
} }

Loading…
Cancel
Save