记录详情

Compile Error

foo.cc: In lambda function:
foo.cc:33:40: error: expected '{' before '[' token
   33 |   for(int i=0;i<3;i++)cin>>x[i][0]>>[i][1];
      |                                        ^
foo.cc: In function 'int main()':
foo.cc:33:40: error: no match for 'operator[]' (operand types are 'main()::<lambda()>' and 'int')
foo.cc:34:28: error: 'Complex::Complex(int, int)' is private within this context
   34 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |                            ^
foo.cc:8:3: note: declared private here
    8 |   Complex(int a,int b){real=a;imag=b;}
      |   ^~~~~~~
foo.cc:34:47: error: 'Complex::Complex(int, int)' is private within this context
   34 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |                                               ^
foo.cc:8:3: note: declared private here
    8 |   Complex(int a,int b){real=a;imag=b;}
      |   ^~~~~~~
foo.cc:34:66: error: 'Complex::Complex(int, int)' is private within this context
   34 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |                                                                  ^
foo.cc:8:3: note: declared private here
    8 |   Complex(int a,int b){real=a;imag=b;}
      |   ^~~~~~~
foo.cc:34:68: error: 'Complex::Complex()' is private within this context
   34 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |                                                                    ^
foo.cc:7:3: note: declared private here
    7 |   Complex(){}
      |   ^~~~~~~
foo.cc:34:70: error: 'Complex::Complex()' is private within this context
   34 |   Complex a(x[0][0],x[0][1]),b(x[1][0],x[1][1]),c(x[2][0],x[2][1]),d,e;
      |                                                                      ^
foo.cc:7:3: note: declared private here
    7 |   Complex(){}
      |   ^~~~~~~
foo.cc:35:11: error: 'Complex Complex::plus(Complex, Complex)' is private within this context
   35 |   d=d.plus(a,b);e=e.plus(d,c);e.Output;
      |     ~~~~~~^~~~~
foo.cc:9:11: note: declared private here
    9 |   Complex plus(Complex a,Complex b)
      |           ^~~~
foo.cc:35:25: error: 'Complex Complex::plus(Complex, Complex)' is private within this context
   35 |   d=d.plus(a,b);e=e.plus(d,c);e.Output;
      |                   ~~~~~~^~~~~
foo.cc:9:11: note: declared private here
    9 |   Complex plus(Complex a,Complex b)
      |           ^~~~
foo.cc:35:33: error: invalid use of non-static member function 'void Complex::Output()'
   35 |   d=d.plus(a,b);e=e.plus(d,c);e.Output;
      |                               ~~^~~~~~
foo.cc:23:8: note: declared here
   23 |   void Output()
      |        ^~~~~~
foo.cc:36:11: error: 'Complex Complex::mult(Complex, Complex)' is private within this context
   36 |   d=d.mult(a,b);e=e.mult(d,c);e.Output;
      |     ~~~~~~^~~~~
foo.cc:16:11: note: declared private here
   16 |   Complex mult(Complex a,Complex b)
      |           ^~~~
foo.cc:36:25: error: 'Complex Complex::mult(Complex, Complex)' is private within this context
   36 |   d=d.mult(a,b);e=e.mult(d,c);e.Output;
      |                   ~~~~~~^~~~~
foo.cc:16:11: note: declared private here
   16 |   Complex mult(Complex a,Complex b)
      |           ^~~~
foo.cc:36:33: error: invalid use of non-static member function 'void Complex::Output()'
   36 |   d=d.mult(a,b);e=e.mult(d,c);e.Output;
      |                               ~~^~~~~~
foo.cc:23:8: note: declared here
   23 |   void Output()
      |        ^~~~~~
foo.cc: At global scope:
foo.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^
[Hydro](https://hydro.ac)提供评测服务

信息

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