就是这个,有人帮帮忙吗,没学懂啊(ฅ•﹏•ฅ)
1、
class Count
{
public:
void SaveMoney(int money)
{
this->fund = this->fund + money;
cout << "存钱数为:" << money << "余额为:" << this->fund << endl;
}
void DraweMoney(int money)
{
this->fund = this->fund + money;
cout << "取钱数为:" << money << "余额为:" << this->fund << endl;
}
string name;
int fund;
};
中午吃饭 着急 没细看
#include
using namespace std;
class Count
{
public:
void SaveMoney(int money)
{
this->fund = this->fund + money;
cout << "存钱数为:" << money << "余额为:" << this->fund << endl;
}
void DraweMoney(int money)
{
this->fund = this->fund - money;
cout << "取钱数为:" << money << "余额为:" << this->fund << endl;
}
string name;
int fund;
};
class Ctime
{
public:
Ctime()
{
this->hou = 0;
this->min = 0;
this->sec = 0;
}
Ctime(short hou)
{
this->hou = hou;
this->sec = 0;
this->min = 0;
}
Ctime(int min)
{
this->min = min;
this->hou = 0;
this->sec = 0;
}
Ctime(float sec)
{
this->sec = sec;
this->hou = 0;
this->min = 0;
}
Ctime(short hou, int min, float sec)
{
this->hou = hou;
this->min = min;
this->sec = sec;
}
void ShowTime()
{
cout << "当前时间为:" << this->hou << ":" << this->min << ":" << this->sec << endl;
}
short hou;
int min;
float sec;
};
void test01()
{
Count C;
C.name = "储户1";
C.fund = 0;
C.SaveMoney(1000);
C.DraweMoney(500);
}
void test02()
{
short a = 8;
int b = 17;
float c = 23.0f;
Ctime C1;
C1.ShowTime();
Ctime C2(a);
C2.ShowTime();
Ctime C3(b);
C3.ShowTime();
Ctime C4(c);
C4.ShowTime();
Ctime C5(a, b, c);
C5.ShowTime();
}
int main()
{
test01();
test02();
return 0;
}