Compile Error

foo.cc: In function 'int main()':
foo.cc:10:31: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int')
     cout<<"面积为:"<<sum=9;
                               ^
In file included from /usr/include/c++/7/iostream:39:0,
                 from foo.cc:1:
/usr/include/c++/7/ostream:402:7: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]
       operator=(basic_ostream&& __rhs)
       ^~~~~~~~
/usr/include/c++/7/ostream:402:7: note:   no known conversion for argument 1 from 'int' to 'std::basic_ostream<char>&&'
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1002 求正方形的面积
语言
C++
递交时间
2021-10-17 16:53:42
评测时间
2021-10-17 16:53:42
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes