Problem Statement:
Define a class to represent a bank account. Include the following members:
1. Name of the depositor
2. Account Number
3. Type of account
4. Balance amount in the account
Member Functions
1. To assign initial values
2. To deposit an amount
3. To withdraw an account after checking the balance
4. To display name and balance
Write a main() function to test your program
What I did:
Code:
#include<iostream>
class account
{
private:
string name;
int acnum;
bool type; //0 for savings, 1 for current account
int balance;
public:
account()
{
cout<<"\nName of customer";
cin>>name;
cout<<"\nAccount Number";
cin>>acnum;
cout<<"\nType--->0/1";
cin>>type;
cout<<"\nInitial balance";
cin>>balance;
}
void deposit()
{
cout<<"\nDeposit Amount:";
cin>>int amount;
balance+=amount;
cout<<"\nDone";
}
void withdraw()
{
cout<<"\nWithdraw Amount";
cin>>int amount;
if(amount<=balance)
{
balance-=amount;
cout<<"\nDone";
}
else
{
cout<<"\nGet lost @#$%^&*";
}
}
void display()
{
cout<<endl<<name;
cout<<endl<<balance;
}
Now I have no idea how to write the main function
Thank you for any help