-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccount.cpp
More file actions
63 lines (58 loc) · 1.1 KB
/
Copy pathBankAccount.cpp
File metadata and controls
63 lines (58 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<iostream>
using namespace std;
class Bank{
public:
string name;
long long int amount;
long long int balance=0;
long long int depositAmount;
long long int withdrawAmount;
int choice;
public:
void checkBalance(){
cout<<"Your current balance is="<<balance<<endl;
}
void deposit(){
cout<<"Enter deposit amount.\n";
cin>>amount;
balance+=amount;
}
void withDraw(){
cout<<"Enter your withdrawal amonunt.\n";
cin>>amount;
if(amount<0 || amount>balance){
cout<<"Invalid input.\n";
}else{
balance-=amount;
}
}
int exit(){
return 0;
}
};
int main(){
Bank obj;
again:
cout<<"1)Check Balance.\n";
cout<<"2)Deposit amount.\n";
cout<<"3)With draw amonut.\n";
cout<<"4.Exit.\n";
cin>>obj.choice;
switch(obj.choice){
case 1:
obj.checkBalance();
goto again;
case 2:
obj.deposit();
goto again;
case 3:
obj.withDraw();
goto again;
case 4:
obj.exit();
break;
default:
cout<<"Please choose the corrct option.\n";
}
return 0;
}