记录详情

Compile Error

foo.cc:8:3: error: ISO C++ forbids declaration of 'Complex' with no type [-fpermissive]
    8 |   Complex(){}
      |   ^~~~~~~
foo.cc:9:3: error: ISO C++ forbids declaration of 'Complex' with no type [-fpermissive]
    9 |   Complex(int a,int b){real=a;imag=b;}
      |   ^~~~~~~
foo.cc:10:3: error: 'Complex' does not name a type; did you mean 'Cpmplex'?
   10 |   Complex plus(Complex a,Complex b)
      |   ^~~~~~~
      |   Cpmplex
foo.cc:17:3: error: 'Complex' does not name a type; did you mean 'Cpmplex'?
   17 |   Complex mult(Complex a,Complex b)
      |   ^~~~~~~
      |   Cpmplex
foo.cc: In member function 'int Cpmplex::Complex()':
foo.cc:8:13: warning: no return statement in function returning non-void [-Wreturn-type]
    8 |   Complex(){}
      |             ^
foo.cc: In member function 'int Cpmplex::Complex(int, int)':
foo.cc:9:38: warning: no return statement in function returning non-void [-Wreturn-type]
    9 |   Complex(int a,int b){real=a;imag=b;}
      |                                      ^
foo.cc: In function 'int main()':
foo.cc:34:7: error: 'i' was not declared in this scope
   34 |   for(i=0;i<3;i++){cin>>x[i][0]>>x[i][1];}
      |       ^
foo.cc:35:3: error: 'Complex' was not declared in this scope; did you mean 'Cpmplex'?
   35 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |   ^~~~~~~
      |   Cpmplex
foo.cc:36:3: error: 'd' was not declared in this scope
   36 |   d=d.plus(a,b);e=e.plus(d,c);e.Output();
      |   ^
foo.cc:36:12: error: 'a' was not declared in this scope
   36 |   d=d.plus(a,b);e=e.plus(d,c);e.Output();
      |            ^
foo.cc:36:14: error: 'b' was not declared in this scope
   36 |   d=d.plus(a,b);e=e.plus(d,c);e.Output();
      |              ^
foo.cc:36:17: error: 'e' was not declared in this scope
   36 |   d=d.plus(a,b);e=e.plus(d,c);e.Output();
      |                 ^
foo.cc:36:28: error: 'c' was not declared in this scope
   36 |   d=d.plus(a,b);e=e.plus(d,c);e.Output();
      |                            ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1011 OO2-1 复数类的算术、赋值运算符的重载
语言
C++
递交时间
2022-09-14 12:03:59
评测时间
2022-09-14 12:03:59
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes