-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank account.cpp
44 lines (44 loc) · 947 Bytes
/
bank account.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
#include<iostream>
using namespace std;
class Ac{
private:
int number,amt;
string name,type;
public:
Ac(string n,string t){
name=n;
type=t;
number=12122;
amt=0;
}
void deposit(){
int dep;
cout<<"Enter The Amount You Want To Deposit::"<<endl;
cin>>dep;
amt=amt+dep;
cout<<"Rs. "<<dep<<" depositted successfully. Your Account Balance is "<<amt<<endl;
};
void withdraw(){
int with;
cout<<"Enter The Amount You Want To Withdraw::"<<endl;
cin>>with;
if (amt>with){
amt=amt-with;
cout<<"Rs. "<<with<<" removed successfully. Your Account Balance is "<<amt<<endl;
}
else{
cout<<"Your Account Has Insufficient Balance"<<endl;
}
};
};
int main(){
string n,t;
cout<<"Enter The Name Of Account Holder: "<<endl;
cin>>n;
cout<<"Enter The Type Of Account: "<<endl;
cin>>t;
Ac a1(n,t);
a1.deposit();
a1.withdraw();
return 0;
};