#include<iostream>
#include<bits/stdc++.h>
using namespace std;
class Bank{
public:
char ah_name[100];
int ac_number;
int ac_balance;
void input()
{
cout<<"Enter Account holder name : ";
cin>>ah_name;
cout<<"Enter account number : ";
cin>>ac_number;
cout<<"Enter Account Balance : ";
cin>>ac_balance;
cout<<endl;
}
void deposit(int n)
{
ac_balance += n;
cout<<"Money deposited successfully"<<endl<<endl;
}
void withraw(int n)
{
if(n <= ac_balance)
{
ac_balance -= n;
cout<<"Money Withdraw successfully"<<endl<<endl;
}
else{
cout<<"Less current balance"<<endl<<endl;
}
}
void display()
{
cout<<"Account holder name : "<<ah_name<<endl;
cout<<"Account number : "<<ac_number<<endl;
cout<<"Account balance : "<<ac_balance<<endl;
}
};
int main()
{
Bank b;
b.input();
cout<<endl<<endl<<"Account User details "<<endl<<"--------------------------------"<<endl;
b.display();
cout<<endl<<endl;
cout<<"Enter amount u want to deposit : ";
int n;
cin>>n;
b.deposit(n);
cout<<endl<<endl;
b.display();
cout<<endl<<endl;
cout<<"Enter amount u want to withdraw : ";
int m;
cin>>m;
b.withraw(m);
cout<<endl<<endl;
b.display();
}
Comments
Leave a comment