diff --git a/src/.mainMenu.c.swp b/src/.mainMenu.c.swp new file mode 100644 index 0000000..450d36d Binary files /dev/null and b/src/.mainMenu.c.swp differ diff --git a/src/mainMenu.c b/src/mainMenu.c new file mode 100644 index 0000000..9bdfccb --- /dev/null +++ b/src/mainMenu.c @@ -0,0 +1,93 @@ + +#include"mainMenu.h" + + +bool agePermission(int age){ + + if(age >= 18) + { + + return true; + + } + + else + { + + return false; + + } + +} + +bool checkIfInteger(char* input){ + + char *end_pointer; + + strtol(input, &end_pointer, 10); + + if (end_pointer == input || *end_pointer != '\0') + { + + return false; + + } + + else + { + + return true; + + } +} + +void ageInput(){ + + char input[20]; + char* input_pointer; + + long age; + + printf("\nPlease specify your age : "); + scanf("%s",input); + + if (checkIfInteger(input) == true ) + { + age = strtol(input,&input_pointer,10); + + if(agePermission(age)== true) + { + printf("Access granted!\n\n\n\n"); + + showMenu(); + + } + else if(agePermission(age)== false) + { + + printf("You should be at least 18 years old to create a bank account!\n"); + + } + } + + else + { + + printf("input invalid! try again!\n"); + + } + +} + + +void showMenu(){ + + 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\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\t\t ->Exit.\n"); + printf("\n\n\n\n\n Selection :\n"); + +} diff --git a/src/mainMenu.h b/src/mainMenu.h new file mode 100644 index 0000000..f62dda9 --- /dev/null +++ b/src/mainMenu.h @@ -0,0 +1,15 @@ +#ifndef MAINMENU_H_ +#define MAINMENU_H_ + +#include +#include +#include +#include + +void showMenu(); +void ageInput(); + +bool agePermission(int age); +bool checkIfInteger(char* input); + +#endif diff --git a/src/run_BankManagementSimulator b/src/run_BankManagementSimulator new file mode 100755 index 0000000..44db506 Binary files /dev/null and b/src/run_BankManagementSimulator differ diff --git a/src/run_BankManagementSimulator.c b/src/run_BankManagementSimulator.c new file mode 100644 index 0000000..d1b3aa4 --- /dev/null +++ b/src/run_BankManagementSimulator.c @@ -0,0 +1,8 @@ +#include"mainMenu.h" + +int main() +{ + + ageInput(); + +}