C++构造函数怎么改啊?
#include <iostream>using namespace std;
class time
{
public:
time() //constructor.构造函数
{
hour=0;
minute=0;
sec=0; }
void set_time();
void show_time();
private:
int hour;
int minute;
int sec;
};
int main()
{
class time t1;
t1.show_time();
t1.set_time();
t1.show_time();
return 0;
}
void time::set_time()
{
cin >>hour;
cin >>minute;
cin >>sec;
}
void time::show_time()
{ cout<<hour<<":"<<minute<<":"<<sec<<endl;
}
g:\vc++ 6.0\c++程序\构造函数.cpp(25) : error C2018: unknown character '0xa1'
g:\vc++ 6.0\c++程序\构造函数.cpp(25) : error C2018: unknown character '0xa1'
g:\vc++ 6.0\c++程序\构造函数.cpp(25) : error C2018: unknown character '0xa1'
g:\vc++ 6.0\c++程序\构造函数.cpp(25) : error C2018: unknown character '0xa1'
g:\vc++ 6.0\c++程序\构造函数.cpp(26) : error C2018: unknown character '0xa1'
g:\vc++ 6.0\c++程序\构造函数.cpp(26) : fatal error C1003: error count exceeds 100; stopping compilation
执行 cl.exe 时出错.
构造函数.exe - 1 error(s), 0 warning(s)