Hi everyone, This is david, Good day, we had a project in our cs class, creating a banking system, i already create one, but i am having a problem with some part, i am using turbo c++
The output should be the menu first, with 6 choices
1.open bank account
2. check balance
3.deposit
4.withdraw
5.close bank account
6.exit
the objective is to display this 6 items but first they need to choose number 1 which is the open bank account, if they choose other number, it will come up with error and it will just comeback to the menu that is my first problem, cant do it, second problem after creating a bank account, all the options will be enabled but they cannot create a bank account again, they should close it first
Here is the code that i created
Thanks in advanced, for anyone that can help meCode:#include <stdio.h> #include <dos.h> #include <stdlib.h> #include<iostream.h> #include<conio.h> void main (void) { char name[32]; float bal,x; int c1,c2; c2=bal=0; c1=1; while (c1 != 0) { clrscr(); //heading(); cout<<"========================================\n"; cout<<"=Welcome to Gomez Bank=\n"; cout<<"========================================\n"; cout<<"1. Open Bank Account\n"; cout<<"2. Check Balance\n"; cout<<"3. Deposit\n"; cout<<"4. Withdraw\n"; cout<<"5. Close Bank Account\n"; cout<<"6. Exit\n"; cout<<"Please enter your transaction: "; cin>>c1; clrscr(); switch(c1) { case 1: cout<<"\nPlease Enter Your Full Name: "; gets(name); clrscr(); do { cout<<"\n\n\t\t\tNote 500 is the minimuim deposit"; cout<<"\n\nPlease Enter Your Initial Deposit: "; cin>>x; }while(x < 500); bal = bal + x; getch(); cout<<"Would you like to do another transaction?\n"; cout<<"1.Confirm 2.Exit\n"; cout<<"Enter your choice: "; cin>>c2; if (c2 == 2) {c1 = 0; break;} else if(c2 ==1){ break; } case 2: cout<<"Your current balance is: "<<bal<<"\n"; cout<<"Would you like to do another transaction?\n"; cout<<"1.Confirm 2.Exit\n"; cout<<"Enter your choice: "; cin>>c2; if (c2 == 2) {c1 = 0;} else; break; case 3: cout<<"Enter the value you would like to deposit: "; cin>>x; while(x<=0) { cout<<"The value you've entered is invalid. \nPlease try again: "; cin>>x; } bal = bal + x; cout<<"Would you like to do another transaction?\n"; cout<<"1.Confirm 2.Exit\n"; cout<<"Enter your choice: "; cin>>c2; if (c2 == 2) {c1 = 0;} else; break; case 4: cout<<"Enter the value you would like to withdraw "; cin>>x; //bal - x < 500 while (x > bal || x <=0 || bal - x < 500) { cout<<"The value you've entered is invalid. \nPlease try again: "; cin>>x; } cout<<"Would you like to do another transaction?\n"; cout<<"1.Confirm 2.Exit\n"; cout<<"Enter your choice: "; cin>>c2; if (c2 == 2) {c1 = 0;} else; bal = bal - x; break; case 5: case 6: c1 = 0; break; } }; cout<<"\n\n\n\t\tThank you for using Gomez Banking Systems!"; getch(); }