0

No match for operator <<

What's wrong with using << for cout? :( https://sololearn.com/compiler-playground/c67WJOIWXf54/?ref=app

19th Oct 2024, 9:07 PM
StarCodes
7 Réponses
+ 3
StarCodes as Jerry Hobby explained, your problem is using unescaped '\' in lines 7 and 9. cout << "/ \" << endl; should be cout<<"/ \\"<<endl; cout << "\___/" << endl; should be cout<<"\\___/"<<endl;
20th Oct 2024, 10:47 AM
Bob_Li
Bob_Li - avatar
+ 5
you can also use raw string literal cout << R"x( your string )x""\n"; then you won't need to bother with escape characters and newlines https://sololearn.com/compiler-playground/c1r2S83weC09/?ref=app
20th Oct 2024, 11:47 AM
Bob_Li
Bob_Li - avatar
+ 4
The problem is with the text. You have a backslash. That needs to be escaped because it’s special. Check this #include <iostream> using namespace std; int main() { //circle cout << " ___" << endl; cout << "/ \\" << endl; cout << "| |" << endl; cout << "\\___/" << endl; }
20th Oct 2024, 12:47 AM
Jerry Hobby
Jerry Hobby - avatar
+ 2
Show us the code. The << operator should work, but we can't see what's wrong until we see your code.
19th Oct 2024, 9:27 PM
Jerry Hobby
Jerry Hobby - avatar
+ 2
StarCodes are you using the single character « instead of <<? It resembles the << left shift operator. However, it is not used as an operator in programming languages but can visually resemble the << symbol.
19th Oct 2024, 10:54 PM
Brian
Brian - avatar
+ 2
You can use char() instead of escape characters StarCodes
21st Oct 2024, 3:10 PM
Mehdi Eslami
Mehdi Eslami - avatar
0
Brian No, I usually make projects on mobile.
20th Oct 2024, 12:38 AM
StarCodes