大家看看这个简单的程序是怎么了呀?(高手莫入)
下面是我写的一个简单的小程序,但是无法编译通过!
#include <iostream.h>
class mytime
{
public:
int tm_hour;
int tm_min;
int tm_sec;
public:
void get()
{
cout<<tm_hour<<":"<<tm_min<<":"<<tm_sec<<endl;
}
void set(int,int,int);
}
保存为mytime.h文件。
#include "mytime.h"
mytime::set(int h,int m,int s)
{
hour=h;
min=m;
sec=s;
}
保存为mytime.cpp文件。
然后是主文件,如下:
void main() //error:too many type proto>>
{
mytime mtime;
mtime.set(12,35,35);
mtime.get();
} //warning:function should return a value;
为什么不能编译通过呀,是不是我定义的头文件有问题呀,请指教!