#define
.
.
#endif
要怎么用啊 小弟到现在都没弄明白啊
#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;
t.printmilitary();
t.settime(13,27,6);
t.printmilitary();
return 0;
}
他提示是划线的地方错
错误提示是: statement missing ;
undefined symbol 't'
我用的是tc++啊
[此贴子已经被作者于2006-7-16 22:15:29编辑过]