forked from zatch3301/RTU-DigitalLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank account.cpp
More file actions
56 lines (56 loc) · 931 Bytes
/
Bank account.cpp
File metadata and controls
56 lines (56 loc) · 931 Bytes
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
#include<iostream>
using namespace std;
class bankaccount
{
char name[10];
int accno;
float balance;
char accType[20];
char dateofbirth;
public:
//constructor
bankaccount()
{
cin>>accno;
cin>>name;
cin>>accType;
cin>>dateofbirth;
cin>>balance;
}
void deposit();
void withdraw();
void display();
};
void bankaccount::deposit()
{
float a;
cout<<"deposit:";
cout<<"enter amount to deposit:";
cin>>a;
balance+=a;
}
void bankaccount::withdraw()
{
float amount;
cout<<"withdraw:";
cout<<"enter amount to withdraw:";
cin>>amount;
balance-=amount;
}
void bankaccount::display()
{
cout<<"account details is:";
cout<<"name of depositer:"<<name<<endl;
cout<<"account no.:"<<accno<<endl;
cout<<"account type:"<<accType<<endl;
cout<<"balance:"<<balance<<endl;
cout<<"dateofbirth:"<<dateofbirth<<endl;
}
int main()
{
bankaccount acc;
acc.deposit();
acc.display();
acc.withdraw();
acc.display();
}