.....Something is Wrong.......
It is telling me that name, type, acnum and balance are private, so something is wrong. Dunno what.
Code:
#include<iostream>
using namespace std;
int menu();
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(int amountzzz)
{
/*int amount;
cout<<"\nDeposit Amount:";
cin>>amount;
balance+=amount;
cout<<"\nDone";*/
balance+=amountzzz;
}
void withdraw(int amountzzz)
{
/*int amount;
cout<<"\nWithdraw Amount";
cin>>amount;
if(amount<=balance)
{
balance-=amount;
cout<<"\nDone";
}
else
{
cout<<"\nGet lost @#$%^&*";
}*/
balance-=amountzzz;
}
void display() //??
{
cout<<endl<<name;
cout<<endl<<balance;
}
};
int main()
{
int amountzzz;
account customer1;
cout<<"\nName of customer";
cin>>customer1.name;
cout<<"\nAccount Number";
cin>>customer1.acnum;
cout<<"\nType--->0/1";
cin>>customer1.type;
cout<<"\nInitial balance";
cin>>customer1.balance;
int flag=menu();
if(flag==1)
{
cout<<"\nDeposit Amount:";
cin>>amountzzz;
customer1.deposit(amountzzz);
}
if(flag==2)
{
cout<<"\nWithdraw Amount";
cin>>amountzzz;
if(amountzzz<=balance)
customer1.withdraw(amountzzz);
else
cout<<"\nGet lost @#$%^&*";
}
if(flag==3)
customer1.display();
return 0;
}
int menu()
{
int flag;
/*PRINT THE MENU*/
cout<<"\nEnter your choice";
cin>>flag;
return flag;
}