From d24ec51fe349894f15c20aec6e2d7303a6891ba0 Mon Sep 17 00:00:00 2001 From: fdai7207 Date: Mon, 30 Jan 2023 19:44:01 +0100 Subject: [PATCH] implement the function menuInput(), in order for the user to choose a banking option. --- src/mainMenu.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/mainMenu.h | 1 + 2 files changed, 54 insertions(+) diff --git a/src/mainMenu.c b/src/mainMenu.c index 7e467da..163dacf 100644 --- a/src/mainMenu.c +++ b/src/mainMenu.c @@ -66,6 +66,8 @@ void ageInput() menuInput(); + menuInput(); + break; } @@ -88,6 +90,57 @@ void ageInput() } +} +void menuInput() +{ + + char choiceInput[20]; + + char* choiceInputPointer; + + int selection; + + scanf("%s",choiceInput); + + 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 : printf("\ncreateCostumerAccount() function will be implemented here soon\n\n"); + + 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 menuInput() diff --git a/src/mainMenu.h b/src/mainMenu.h index 1be573f..4907629 100644 --- a/src/mainMenu.h +++ b/src/mainMenu.h @@ -13,6 +13,7 @@ bool chooseOption(int choiceInput); void ageInput(); void menuInput(); void showMenu(); +void menuInput(); #endif