-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbank.cpp
68 lines (58 loc) · 1.29 KB
/
bank.cpp
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
64
65
66
67
68
#include <iostream>
using namespace std;
class bank {
private:
int ac_no, ac_type, b_amnt, dep, wit;
char name[20];
public:
void getdata();
void deposit();
void withdraw();
void display();
};
void bank::getdata() {
cout << "\n Enter the Name of account holder : ";
cin >> name;
cout << "\n Enter the Acc.Number :";
cin >> ac_no;
cout << " \nEnter the ac_type \n1.current \n2.saving ";
cin >> ac_type;
cout << "\nEnter the Balance amount in the account :";
cin >> b_amnt;
}
void bank::deposit() {
cout << "\n Enter the amount of deposit :";
cin >> dep;
b_amnt = dep + b_amnt;
}
void bank::withdraw() {
cout << "\nYour Current Balance is \n" << b_amnt;
cout << "\nEnter the Amount \n";
cin >> wit;
if(b_amnt - wit>=250){
b_amnt = b_amnt - wit;
}else
cout<< "INSUFFICIENT BALANCE \n";
}
void bank::display() {
cout << "Hi " << name << endl;
cout << "balance = " << b_amnt << endl;
}
int main() {
int x=1;
bank b;
b.getdata();
while (x > 0) {
cout << "Enter \n 1.for Deposit \n 2.for Withdraw \n 0.for exit\n";
cin >> x;
switch (x) {
case 1:
b.deposit();
b.display();
break;
case 2:
b.withdraw();
b.display();
}
}
}