-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank_menu.cpp
185 lines (170 loc) · 3.25 KB
/
Bank_menu.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include <bits/stdc++.h>
using namespace std;
class bank
{
private:
string name;
int accno;
char type;
int amount=0;
int tot=0;
public:
void setvalue()
{
cout<<"Enter name\n";
cin>>name;
cout<<"Enter account number\n";
cin>>accno;
cout<<"Enter account type\n";
cin>>type;
}
void showdata()
{
cout<<"Name:"<<name<<endl;
cout<<"Account No:"<<accno<<endl;
cout<<"Account type:"<<type<<endl;
}
void total()
{
cout<<"\nEnter amount\n";
cin>>amount;
}
void showbal()
{
tot=tot+amount;
cout<<"Total balance is: "<<tot;
}
} ;
int main(void)
{
bank b;
int choice;
while(1)
{
cout<<"\nEnter your choice\n";
cout<<"\t1. Enter name,account number,account type\n";
cout<<"\t2. Show the data\n";
cout<<"\t3. Enter amount\n";
cout<<"\t4. Show total balance\n";
cout<<"\t5. To exit\n";
cin>>choice;
switch(choice)
{
case 1:
b.setvalue();
break;
case 2:
b.showdata();
break;
case 3:
b.total();
break;
case 4:
b.showbal();
break;
case 5:
exit(1);
break;
default:
cout<<"\nInvalid choice\n";
}
}
}
/*
#include<iostream>
#include<stdlib.h>
#include<string>
#include<math.h>
using namespace std;
class account
{
string name;
int accno;
char type[10];
public:
void getdata()
{
cout<<"Enter name\n";
cin>>name;
cout<<"Enter account number\n";
cin>>accno;
cout<<"Enter account type\n";
cin>>type;
}
void showdata()
{
cout<<"\nName:"<<name<<endl;
cout<<"Account No:"<<accno<<endl;
cout<<"Account type:"<<type<<endl;
}
} ;
class current : public account
{
int balance;
int amount;
public:
current()
{
balance=0;
amount=0;
}
void getdata()
{
account::getdata();
cout<<"Enter amount to be deposited : ";cin>>amount;
}
void total()
{
balance=balance+amount;
cout<<"Total balance is :"<<balance;
}
void showdata()
{
account::showdata();
current::total();
cout<<"\nCheck book is available."<<endl;
cout<<"No interest is available."<<endl;
cout<<"Minimum balance should be Rs. 500."<<endl;
}
};
class saving : public account
{
private:
int amount,rate,time;
double CI;
public:
saving()
{
amount=0;
rate=10;
time=0;
CI=0.0;
}
void getdata()
{
account::getdata();
cout<<"Enter amount to be added : "<<endl;
cin>>amount;
cout<<"Enter time : "<<endl;
cin>>time;
}
void cint()
{
CI = amount*(pow((1+rate/100),time));
cout <<"\nCompound interest is " << CI;
}
void showdata()
{
account::showdata();
saving::cint();
cout<<"\nNo check-book facility for this account"<<endl;
}
};
int main()
{
saving s;
s.getdata();
s.showdata();
return 0;
}
*/