-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram9.cpp
More file actions
82 lines (71 loc) · 1.49 KB
/
program9.cpp
File metadata and controls
82 lines (71 loc) · 1.49 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<iostream>
using namespace std;
class Bankac
{
private:
char name[100];
char actype[100];
int acnum;
int acbalance;
public:
void intialize()
{
cout<<"enter account holders name:";
cin>>name;
cout<<"enter type of account:";
cin>>actype;
cout<<"enter the account number";
cin>>acnum;
cout<<"enter account balance";
cin>>acbalance;
}
void deposit()
{
int amount;
cout<<"enter the amount to depost";
cin>>amount;
acbalance+=amount;
cout<<"deposit succesful, new balance:"<<acbalance;
}
void check()
{ int amount;
cout<<"enter amouint to withdraw:";
cin>>amount;
if(amount<=acbalance)
{
acbalance-=amount;
cout<<"amount debited with remaining balance:"<<acbalance;
}
else
{
cout<<"cannot withdraw";
}
}
void display()
{
cout<<"account holders name:"<<name<<endl;
cout<<"account type:"<<actype<<endl;
cout<<"account number:"<<acnum<<endl;
cout<<"balance:"<<acbalance<<endl;
}
};
int main()
{
int i;
Bankac customern;
customern.intialize();
cout<<"for account detail enter 1\n";
cout<<"for deposit enter 2\n";
cout<<"to wihdraw enter 3\n";
cin>>i;
if(i==1)
{customern.display();
}
else if(i==2)
{customern.deposit();}
else if(i==3)
{customern.check();}
else if (i==0||i>3)
{cout<<"error";}
return 0;
}