记录详情

Compile Error

foo.cc: In function 'BigInt operator*(BigInt&, int)':
foo.cc:22:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for (int i = 0; i < A.v.size() || t; i++)
      |                   ~~^~~~~~~~~~~~
foo.cc:24:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |    if (i < A.v.size())t += A.v[i] * b;
      |        ~~^~~~~~~~~~~~
foo.cc: In function 'BigInt operator+(BigInt&, BigInt&)':
foo.cc:33:40: error: cannot bind non-const lvalue reference of type 'BigInt&' to an rvalue of type 'BigInt'
   33 |   if (A.v.size() < B.v.size())return B + A;
      |                                      ~~^~~
foo.cc:14:17: note:   initializing argument 1 of 'BigInt::BigInt(BigInt&)'
   14 |  BigInt(BigInt &C)
      |         ~~~~~~~~^
foo.cc:36:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   for (int i = 0; i < A.v.size(); i++)
      |                   ~~^~~~~~~~~~~~
foo.cc:39:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |    if (i < B.v.size())t += B.v[i];
      |        ~~^~~~~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:72:21: error: cannot bind non-const lvalue reference of type 'BigInt&' to an rvalue of type 'BigInt'
   72 |  BigInt ans = index + index1;
      |               ~~~~~~^~~~~~~~
foo.cc:14:17: note:   initializing argument 1 of 'BigInt::BigInt(BigInt&)'
   14 |  BigInt(BigInt &C)
      |         ~~~~~~~~^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1024 OO6-2 高精度整数类的加法运算
比赛
2022春 面向对象程序设计方法的上机作业
语言
C++
递交时间
2022-05-15 14:12:46
评测时间
2022-05-15 14:12:46
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes