C++问题.Time类的定义
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/18 04:08:02
C++问题.Time类的定义
为什么我写的程序无法打印出东西呢?也不报错~
#include
using namespace std;
class Time
{
private:
int hour;
int minute;
int second;
public:
Time(int=0,int=0,int=0);
void setTime(int h,int m,int s);
void setHour(int h);
void setMinute(int m);
void setSecond(int s);
int getHour();
int getMinute();
int getSecond();
void printUniversal();
void printStandard();
};
Time::Time(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void Time::setTime(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void Time::setHour(int h)
{
if(h>=24||h
为什么我写的程序无法打印出东西呢?也不报错~
#include
using namespace std;
class Time
{
private:
int hour;
int minute;
int second;
public:
Time(int=0,int=0,int=0);
void setTime(int h,int m,int s);
void setHour(int h);
void setMinute(int m);
void setSecond(int s);
int getHour();
int getMinute();
int getSecond();
void printUniversal();
void printStandard();
};
Time::Time(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void Time::setTime(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}
void Time::setHour(int h)
{
if(h>=24||h
#include
using namespace std;
class Time
{
private:
int hour;
int minute;
int second;
public:
Time(int Hour=0,int Minute=0,int Second=0);
// void setTime(int h,int m,int s);//没有意义,删除,就是构造函数
void setHour(const int Hour);\x05\x05\x05\x05\x05
void setMinute(const int Minute);
void setSecond(const int Second);
int getHour()const;
int getMinute()const;
int getSecond()const;
void printUniversal()const;
void printStandard()const;
};
Time::Time(int Hour,int Minute,int Second)
{
hour=Hour;
minute=Minute;
second=Second;
}
/*void Time::setTime(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}*/
void Time::setHour(const int Hour)
{
if(Hour>=24||Hou
using namespace std;
class Time
{
private:
int hour;
int minute;
int second;
public:
Time(int Hour=0,int Minute=0,int Second=0);
// void setTime(int h,int m,int s);//没有意义,删除,就是构造函数
void setHour(const int Hour);\x05\x05\x05\x05\x05
void setMinute(const int Minute);
void setSecond(const int Second);
int getHour()const;
int getMinute()const;
int getSecond()const;
void printUniversal()const;
void printStandard()const;
};
Time::Time(int Hour,int Minute,int Second)
{
hour=Hour;
minute=Minute;
second=Second;
}
/*void Time::setTime(int h,int m,int s)
{
hour=h;
minute=m;
second=s;
}*/
void Time::setHour(const int Hour)
{
if(Hour>=24||Hou