Problem greeting
User rhea61
Submission Time 2023-11-08 12:47:34
Score 0
Max Time N/A
Max Memory N/A

Compile Error

greeting.cpp: In function ‘int main()’:
greeting.cpp:7:8: error: ‘s’ was not declared in this scope
7 | cin>>s;
| ^
greeting.cpp:8:10: error: redeclaration of ‘std::string greeting’
8 | string greeting = "s" + "ni hao, xin nian kuai le";
| ^~~~~~~~
greeting.cpp:6:9: note: ‘std::string greeting’ previously declared here
6 | string greeting = "s";
| ^~~~~~~~
greeting.cpp:8:25: error: invalid operands of types ‘const char [2]’ and ‘const char [25]’ to binary ‘operator+’
8 | string greeting = "s" + "ni hao, xin nian kuai le";
| ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | const char [25]
| const char [2]
greeting.cpp:9:16: error: expected primary-expression before ‘greeting’
9 | cout<< string greeting
| ^~~~~~~~