记录详情

Compile Error

/in/foo.cc:30:9: error: 'ostream' does not name a type
  friend ostream & operator<<(ostream &out, BigInt &bi)
         ^~~~~~~
/in/foo.cc: In member function 'BigInt& BigInt::operator*(BigInt&)':
/in/foo.cc:69:31: error: invalid initialization of non-const reference of type 'BigInt&' from an rvalue of type 'BigInt'
    res = *this * obj.value[i] << i;
          ~~~~~~~~~~~~~~~~~~~~~^~~~
/in/foo.cc:43:7: note:   initializing argument 1 of 'bool BigInt::operator=(BigInt&)'
  bool operator=(BigInt &bi)
       ^~~~~~~~
/in/foo.cc:70:14: error: invalid initialization of non-const reference of type 'BigInt&' from an rvalue of type 'BigInt'
    sum = sum + res;
          ~~~~^~~~~
/in/foo.cc:43:7: note:   initializing argument 1 of 'bool BigInt::operator=(BigInt&)'
  bool operator=(BigInt &bi)
       ^~~~~~~~
/in/foo.cc:65:18: warning: reference to local variable 'sum' returned [-Wreturn-local-addr]
   BigInt res(0), sum(0);
                  ^~~
/in/foo.cc: In member function 'BigInt BigInt::operator*(int)':
/in/foo.cc:81:4: error: 'cerr' was not declared in this scope
    cerr << "BigInt operator*(int mult_2), invalid parameter: " << mult_2 << endl;
    ^~~~
/in/foo.cc:81:4: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:62:18: note:   'std::cerr'
   extern ostream cerr;  /// Linked to standard error (unbuffered)
                  ^~~~
/in/foo.cc:81:77: error: 'endl' was not declared in this scope
    cerr << "BigInt operator*(int mult_2), invalid parameter: " << mult_2 << endl;
                                                                             ^~~~
/in/foo.cc:81:77: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
                 from /in/foo.cc:1:
/usr/include/c++/6/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~
/in/foo.cc: In member function 'BigInt BigInt::operator+(int)':
/in/foo.cc:112:4: error: 'cerr' was not declared in this scope
    cerr << "BigInt operator+(int add_2), invalid parameter: " << add_2 << endl;
    ^~~~
/in/foo.cc:112:4: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:62:18: note:   'std::cerr'
   extern ostream cerr;  /// Linked to standard error (unbuffered)
                  ^~~~
/in/foo.cc:112:75: error: 'endl' was not declared in this scope
    cerr << "BigInt operator+(int add_2), invalid parameter: " << add_2 << endl;
                                                                           ^~~~
/in/foo.cc:112:75: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
                 from /in/foo.cc:1:
/usr/include/c++/6/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~
/in/foo.cc: In member function 'BigInt BigInt::operator<<(int)':
/in/foo.cc:172:4: error: 'cerr' was not declared in this scope
    cerr << "BigInt operator<<(int n), parameter: " << n << " is too big." << endl;
    ^~~~
/in/foo.cc:172:4: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:62:18: note:   'std::cerr'
   extern ostream cerr;  /// Linked to standard error (unbuffered)
                  ^~~~
/in/foo.cc:172:78: error: 'endl' was not declared in this scope
    cerr << "BigInt operator<<(int n), parameter: " << n << " is too big." << endl;
                                                                              ^~~~
/in/foo.cc:172:78: note: suggested alternative:
In file included from /usr/include/c++/6/iostream:39:0,
                 from /in/foo.cc:1:
/usr/include/c++/6/ostream:590:5: note:   'std::endl'
     endl(basic_ostream<_CharT, _Traits>& __os)
     ^~~~
/in/foo.cc: In function 'int main(int, char**)':
/in/foo.cc:199:2: error: 'cout' was not declared in this scope
  cout << ans;
  ^~~~
/in/foo.cc:199:2: note: suggested alternative:
In file included from /in/foo.cc:1:0:
/usr/include/c++/6/iostream:61:18: note:   'std::cout'
   extern ostream cout;  /// Linked to standard output
                  ^~~~
/in/foo.cc:193:6: warning: unused variable 'x' [-Wunused-variable]
  int x = 2, k = 10;
      ^

信息

递交者
类型
自测
题目
P1023 OO6-1 高精度整数类的乘法运算
语言
C++
递交时间
2024-05-02 03:02:33
评测时间
2024-05-02 03:02:33
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes