[求助]这程序通不过 大家看看哪错了
#ifndef time_h
#define time_h
class time{
public:
time();
void settime(int,int,int);
void printmilitary();
private:
int hour;
int minute;
int second;
};
#endif
#include <iostream.h>
#include "time.h"
time::time()
{hour=minute=second=0;}
void time::settime(int h,int m,int s)
{
hour = (h>=0&&h<24)?h:0;
minute = (m>=0&&m<60)?m:0;
second = (s>=0&&s<60)?s:0;
}
void time::printmilitary()
{
cout<<(hour<10?"0":"")<<hour<<":"<<(minute<10?"0":"")<<minute;
}
#include <iostream.h>
#include "time.h"
int main()
{
time t;
cout<<t.printmilitary();
t.settime(13,27,6);
cout<<t.printmilitary();
return 0;
}
通不过啊 说这有错 大家帮我看看啊