#include<iostream>
using namespace std;
class vocation
{
public:
vocation()
{}
vocation(double x, double y, double z);
~vocation()
{}
void Setdinner(double a);
double Getdinner();
void Setsleep(double a);
double Getsleep();
void Setplay(double a);
double Getplay();
private:
double _dinner;
double _sleep;
double _play;
};
vocation::vocation(double x, double y, double z)
{
_dinner = x;
_sleep = y;
_play = z;
}
void vocation::Setdinner(double a)
{
_dinner = a;
}
double vocation::Getdinner()
{
return _dinner;
}
void vocation::Setsleep(double a)
{
_sleep = a;
}
double vocation::Getsleep()
{
return _sleep;
}
void vocation::Setplay(double a)
{
_play = a;
}
double vocation::Getplay()
{
return _play;
}
void main()
{
double a, b, c;
vocation va(6.3, 8.0, 3.0);
cout << "前一天您吃饭的,睡觉,打豆豆的时间分别为: ";
cout << va.Getdinner() << "" << va.Getsleep() << " " << va.Getplay() << endl;
cout << "请按下面的提示输入今天花费于上述3项的时间: " << endl;
cout << "吃饭:";
cin >> a;
cout << "睡觉: ";
cin >> b;
cout << "打豆豆:";
cin >> c;
if ((a + b + c) > 24)
cout << "人才啊,一天当" << a + b + c << "小时用" << endl;
else
{
if (a > 4.5)
cout << "真是个饭桶!" << endl;
va.Setdinner(a);
if (b > 12)
cout << "您原来是一个睡神呀" << endl;
va.Setsleep(b);
if (c > 6)
cout << "亲,您打了这么长的时间您的手不累吗" << endl;
va.Setplay(c);
}
}
哈哈!吃饭 睡觉 打豆豆
最新推荐文章于 2016-11-22 16:41:43 发布