记录详情

Compile Error

/in/foo.cc:10:40: error: ISO C++ forbids declaration of 'SetTime' with no type [-fpermissive]
  SetTime(int hour,int minute,int second)
                                        ^
/in/foo.cc:15:10: error: ISO C++ forbids declaration of 'GetHour' with no type [-fpermissive]
  GetHour(){return hour;}
          ^
/in/foo.cc:16:12: error: ISO C++ forbids declaration of 'GetMinute' with no type [-fpermissive]
  GetMinute(){return minute;}
            ^
/in/foo.cc:17:12: error: ISO C++ forbids declaration of 'GetSecond' with no type [-fpermissive]
  GetSecond(){return second;}
            ^
/in/foo.cc:19:15: error: ISO C++ forbids declaration of 'AddTime' with no type [-fpermissive]
  AddTime(int s){
               ^
/in/foo.cc:24:12: error: ISO C++ forbids declaration of 'PrintTime' with no type [-fpermissive]
  PrintTime(){cout<<this->hour<<" "<this->minute<<" "<this->second<<" "<<endl;}
            ^
/in/foo.cc: In member function 'int Time::SetTime(int, int, int)':
/in/foo.cc:13:16: warning: no return statement in function returning non-void [-Wreturn-type]
   this->second;}
                ^
/in/foo.cc: In member function 'int Time::AddTime(int)':
/in/foo.cc:23:2: warning: no return statement in function returning non-void [-Wreturn-type]
  }
  ^
/in/foo.cc: In member function 'int Time::PrintTime()':
/in/foo.cc:24:48: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<'
  PrintTime(){cout<<this->hour<<" "<this->minute<<" "<this->second<<" "<<endl;}
                                    ~~~~~~~~~~~~^~~~~
/in/foo.cc:24:66: error: invalid operands of types 'int' and 'const char [2]' to binary 'operator<<'
  PrintTime(){cout<<this->hour<<" "<this->minute<<" "<this->second<<" "<<endl;}
                                                      ~~~~~~~~~~~~^~~~~
/in/foo.cc:24:78: warning: no return statement in function returning non-void [-Wreturn-type]
  PrintTime(){cout<<this->hour<<" "<this->minute<<" "<this->second<<" "<<endl;}
                                                                              ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:31:16: error: 'hour' was not declared in this scope
  time1.SetTime(hour,minute,second);
                ^~~~
/in/foo.cc:31:21: error: 'minute' was not declared in this scope
  time1.SetTime(hour,minute,second);
                     ^~~~~~
/in/foo.cc:31:28: error: 'second' was not declared in this scope
  time1.SetTime(hour,minute,second);
                            ^~~~~~
/in/foo.cc:32:16: error: 's' was not declared in this scope
  time1.AddTime(s);
                ^
/in/foo.cc:33:8: error: invalid use of non-static member function 'int Time::PrintTime()'
  time1.PrintTime;
  ~~~~~~^~~~~~~~~
/in/foo.cc:24:2: note: declared here
  PrintTime(){cout<<this->hour<<" "<this->minute<<" "<this->second<<" "<<endl;}
  ^~~~~~~~~

信息

递交者
类型
递交
题目
P1000 OO1-1 时间类Time
语言
C++
递交时间
2024-05-15 17:34:36
评测时间
2024-05-15 17:34:36
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes