-
Notifications
You must be signed in to change notification settings - Fork 0
/
q3t.cpp
109 lines (94 loc) · 2.28 KB
/
q3t.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include<iostream>
using namespace std;
class bank
{
char cust_name[30];
int acc_no;
char acc_type[20];
float balance;
int count = 0;
public:
void details();
void deposit();
void withdraw();
void display();
};
void bank::details()
{
cout << "Enter your name ";
cin >> cust_name;
cout << "Enter account number " ;
cin >> acc_no;
cout << "Enter type of account ";
cin >> acc_type;
cout << "Enter amount of money want to deposit";
cin >> balance;
}
void bank::deposit()
{
float amount;
cout<<"Enter account number" <<endl;
cin >> acc_no;
cout << "Enter amount to be deposited";
cin >> amount;
balance= balance+amount;
cout <<"Amount credited successfully" <<endl;
}
void bank::withdraw()
{
float amt;
cout<<"Enter account number" <<endl;
cin >> acc_no;
cout <<"Enter balance "<<endl;
cin >>balance;
cout << "Enter amount to be withdrawn " << endl;
cin >> amt;
if((balance-amt) >=500)
{
balance=balance-amt;
cout <<"Amount debited successfully" << endl;
}
else
{
cout << "Insufficient balance " << endl;
}
}
void bank::display()
{
cout <<"Name : " << cust_name <<endl;
cout <<"Account number: "<< acc_no <<endl;
cout <<"Account type : " << acc_type <<endl;
cout <<"Balance : " << balance << endl;
}
int main()
{
bank customer[50];
int ch,n;
cout<<"Enter number of customers ";
cin >> n;
for(int i=1;i<=n;i++)
{
do
{
cout<<"Customer " <<i+1 <<endl;
cout <<"WELCOME" << endl;
cout <<"Enter appropraite number"<<endl;
cout <<"1:Add an account " << endl;
cout <<"2:Deposit amount" <<endl;
cout <<"3:Withdraw amount" <<endl;
cout <<"4:Account statement" <<endl;
cout <<"5:Quit" <<endl;
cin >> ch;
switch(ch)
{
case 1: customer[i].details();break;
case 2: customer[i].deposit();break;
case 3: customer[i].withdraw();break;
case 4: customer[i].details();break;
case 5: break;
}
}
while(ch!=5);
}
return 0;
}