Why is it that when I type, cout <<"/ \"<<endl; in c++ i get an error message | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Why is it that when I type, cout <<"/ \"<<endl; in c++ i get an error message

Please explain https://code.sololearn.com/cglSBK2jQSE7/?ref=app

4th Dec 2017, 8:07 PM
Bacon Break11
Bacon Break11 - avatar
5 Answers
+ 19
\ is used to write escape characters, or characters that can't normally be typed in a string. Ex: A newline (\n), a tab (\t), or double quotes (\"). Because of this, \ also has to be escaped. To print one \, you have to type it twice. cout << "/\\" << endl; //Output: /\
4th Dec 2017, 8:14 PM
Tamra
Tamra - avatar
+ 3
Unclosed string. cout tries to print \" as ".
4th Dec 2017, 8:13 PM
zdump
+ 1
cool! thx!!!
5th Mar 2019, 7:52 AM
Виталий Абдюшев
Виталий Абдюшев - avatar
0
You Must Write #include <iostream> on the top of the Programm
10th Mar 2019, 2:56 PM
Felix Tudose
Felix Tudose - avatar
0
And under it you Must Write using namespace std;
10th Mar 2019, 2:59 PM
Felix Tudose
Felix Tudose - avatar