Problem greeting
User Dana
Submission Time 2023-11-09 10:47:02
Score 0
Max Time N/A
Max Memory N/A

Compile Error

greeting.cpp: In function ‘int main()’:
greeting.cpp:5:8: error: no match for ‘operator<<’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘const char [2]’)
5 | S = S << " " << "ni hao, xin nian kuai le!\n";
| ~ ^~ ~~~
| | |
| | const char [2]
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/9/regex:62,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
from greeting.cpp:1:
/usr/include/c++/9/bits/regex.h:1553:5: note: candidate: ‘template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::__cxx11::sub_match<_Bi_iter>&)’
1553 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os,
| ^~~~~~