记录详情

Compile Error

foo.cc:22:16: error: ‘ostream’ does not name a type
   22 |         friend ostream& operator<<(ostream& out,const Complex& c)
      |                ^~~~~~~
foo.cc:30:16: error: ‘istream’ does not name a type
   30 |         friend istream& operator>>(istream& in,Complex& c)
      |                ^~~~~~~
foo.cc: In member function ‘Complex Complex::operator*(const Complex&)’:
foo.cc:21:9: error: expected ‘;’ before ‘}’ token
   21 |         }
      |         ^
foo.cc: In function ‘int main()’:
foo.cc:40:9: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’?
   40 |         cin>>c1>>c2>>c3;
      |         ^~~
      |         std::cin
iostream:62:18: note: ‘std::cin’ declared here
foo.cc:41:9: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’?
   41 |         cout<<c1+c2+c3<<endl;
      |         ^~~~
      |         std::cout
iostream:63:18: note: ‘std::cout’ declared here
foo.cc:41:25: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’?
   41 |         cout<<c1+c2+c3<<endl;
      |                         ^~~~
      |                         std::endl
In file included from iostream:41:
/nix/gcc-14-20241116/include/c++/14-20241116/ostream:741:5: note: ‘std::endl’ declared here
  741 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~

信息

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