#include<iostream>
using namespace std;
class account
{
public:
int de( int i, double b, double a)
{
id = i;
balance = b;
annuleinterestrate = a;
return ;
}
int visit( int b)
{
switch (b)
{
case :cout << id;
return ;
case :cout << balance << endl;
return ;
case :cout << annuleinterestrate << endl;
return ;
}
}
int change(int b)
{
cout << "Please input the content:" << endl;
switch (b)
{
case :cin >> id;
return ;
case :cin >> balance;
return ;
case :cin >> annuleinterestrate ;
return ;
}
}
double GetMonthlyInterestRate()
{
monthlyinterestrate = annuleinterestrate/12.0;
return monthlyinterestrate;
}
double withDraw()
{
double q;
cout << "please input the number:" <<endl;
cin >> q;
balance += q;
return balance;
}
double deposit()
{
double q;
cout << "please input the number:" <<endl;
cin >> q;
balance -= q;
return balance;
}
private:
int id;
double annuleinterestrate,monthlyinterestrate,balance;
};
int main()
{
int a,b;
account acc;
acc.de( ,,0.045 ) ;
cout << "Please intput the function's number: (1 visit; 2 change; 3 GetMonthlyInterestRate;4 withDraw;5 deposit;)" << endl;
cin >> a;
switch (a)
{
case : cout << "which do you chose?(1 id;2 balance;3 annuleinterestrate)" << endl;
cin >> b;
acc.visit( b );
break;
case : cout << "which do you chose?(1 id;2 balance;3 annuleinterestrate)" << endl;
cin >> b;
acc.change( b );
break;
case : cout << acc.GetMonthlyInterestRate() << endl;
break;
case : cout << acc.withDraw() << endl;
break;
case : cout << acc.deposit() << endl;
break;
}
return ;
}

acount-LMLPHP

04-30 07:59