using namespace std;
class Bank_acc
{
private:
char name,type;
long int accno,temp,t,balance;
public:
void putdata()
{
cout<<"Enter Name of account holder: ";
cin>>name>>endl;
cout<<"Enter account number: ";
cin>>accno>>endl;
cout<<"Is the account a savings account or a current account? (s/c): "<<endl;
if(cin>>"s")
type="savings";
if(cin>>"c")
type="current";
cout<<"Enter Your balance amount: ";
cin>>balance;
}
void deposit()
{
cout<<"Enter the amount you want to deposit:";
cin>>temp;
balance=balance+temp;
cout<<endl<<"Your new balance is: "<<balance<<endl;
}
void withdraw()
{
cout<<"Enter the amount you want to withdaw: ";
cin>>temp;
balance=balance-temp;
cout<<endl<<"Your new balance is: "<<balance<<endl;
}
};
void main()
{
bank_acc acc;
cout<<"Enter account details: "<<endl;
acc.putdata();
cout<<endl;
cout<<"what do you want to do?"<<endl<<"1. Display account details"<<endl<<"2. deposit amount"<<endl<<"3. withdraw amount"<<endl;
cin>>t;
switch(t)
{
case 1:
acc.dispdata();
break;
case 2:
acc.deposit();
break;
case 3
acc.withdraw();
break;
default:
cout<<"Invalid entry";
};
}
This code is for entering a set of bankdetails using class
It shows error at line 16 as:
C:\Users\KarnageKnight\Downloads\BANK_ACC.CPP|16|error: no match for 'operator>>' (operand types are 'std::basic_istream<char>' and '<unresolved overloaded function type>')|
Thank you for ur reply Yanson,
yes it shows no error at line 16 now.|
But i have another problem now
At line 21, it reads an error msg stating:
C:\Users\KarnageKnight\Downloads\BANK_ACC.CPP|21|error: no match for 'operator>>' (operand types are 'std::istream {aka std::basic_istream<char>}' and 'const char [2]')|