In C++ how to use " or ' under cout<<" "; | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

In C++ how to use " or ' under cout<<" ";

Like py we use \' or \" under print(" ") to print ' or " on output screen what's in C++ for this ?

8th Oct 2020, 1:02 PM
Tushar Gupta
Tushar Gupta - avatar
3 ответов
+ 4
Almost the same, except single quotes doesn't need escaping in a string or constant char pointer. cout << "\"ok boss\"""" << " it's time to eat";
8th Oct 2020, 1:15 PM
Ipang
+ 4
Slash / doesn't form an escaped character, \ does ... "\n" -> line break (an escaped character). "/n" -> regular string.
8th Oct 2020, 1:23 PM
Ipang
+ 1
Yes it's my mistake I checked it before post question but I use / in place of \
8th Oct 2020, 1:20 PM
Tushar Gupta
Tushar Gupta - avatar