#include<iostream>
#include<conio.h>
#include<string>
usingnamespace std;
class ir;
class Bank_acc
{
private:
string name,type,s;
longint accno,temp,balance,in;
public:
void putdata()
{
cout << "Enter Name of account holder: ";
cin >> name;
cout <<endl<< "Enter account number: ";
cin >> accno;
cout <<endl<< "Is the account a savings account or a current account? (s/c): "<<endl;
cin >> s;
if(s=="s")
type="savings";
if(s=="c")
type="current";
cout<<"Enter Your balance amount: ";
cin>>balance;
}
void dispdata()
{
cout<<"Account holder name: "<<name<<endl;
cout<<"Account number: "<<accno<<endl;
cout<<"Account type: "<<type<<endl;
cout<<"Balance amount: "<<balance<<endl;
}
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;
}
friendvoid ir::interest();
};
class ir
{
public:
void interest(longint balance)
{
longint t;
t=0.05*balance;
cout<<"Principle amount: "<<balance<<endl;
cout<<"Interest earned: "<<t<<endl;
cout<<"Total amount: "<<t+balance<<endl;
}
};
int main()
{
int t;
char q;
ir rate;
Bank_acc acc;
cout<<"Enter account details: "<<endl;
acc.putdata();
cout<<endl;
do
{
cout<<"what do you want to do?"<<endl<<"1. Display account details"<<endl<<"2. Deposit amount"<<endl<<"3. Withdraw amount"<<endl<<"4. Calculate interest"<<endl;
cin>>t;
switch(t)
{
case 1:
acc.dispdata();
break;
case 2:
acc.deposit();
break;
case 3:
acc.withdraw();
break;
case 4:
rate.interest();
default:
cout<<"Invalid entry";
}
cout<<"Do You want to continue?(y/n)"<<endl;
cin>>q;
}while(q=='y');
}
errors are:
|6|error: forward declaration of 'class ir'|
|54|error: invalid use of incomplete type 'class ir'|
|99|error: no matching function for call to 'ir::interest()'|