记录详情

Compile Error

foo.cc: In member function ‘List& List::operator+(List&)’:
foo.cc:130:15: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
  130 |             if(p->coe==0)
      |               ^
foo.cc: In function ‘int main()’:
foo.cc:174:27: error: cannot bind non-const lvalue reference of type ‘List&’ to an rvalue of type ‘List’
  174 |     cout<<La+Lb<<endl<<Laa*Lb;
      |                        ~~~^~~
foo.cc:35:16: note:   initializing argument 1 of ‘List::List(List&)’
   35 |     List(List &L)
      |          ~~~~~~^
foo.cc:111:51: note:   initializing argument 2 of ‘std::ostream& operator<<(std::ostream&, List)’
  111 |     friend ostream & operator<<(ostream &out,List L)
      |                                              ~~~~~^

信息

递交者
类型
递交
比赛
2024级《面向对象的方法与实践》第四次作业
语言
C++
递交时间
2025-04-12 18:56:31
评测时间
2025-04-12 18:56:31
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes