what is the meaning of cout<<"\b="; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the meaning of cout<<"\b=";

you can check the following code https://code.sololearn.com/cI84EK0elxHY/?ref=app

30th Mar 2019, 4:53 PM
Abhishek Dimri
Abhishek Dimri - avatar
6 Answers
+ 3
One space before the equal sign Backlash is used to escape the next character. \b is one space More commonly used is \n for new line And also \\ \" and \'
30th Mar 2019, 5:44 PM
Gordon
Gordon - avatar
30th Mar 2019, 6:17 PM
Ipang
+ 3
@Ipang wow, you are right, if \b works than there will not be the extra + Let me try in repo and see the result.
31st Mar 2019, 12:30 AM
Gordon
Gordon - avatar
+ 2
Thanks Ipang for the support readings, and sorry I answered simple based on the Run result of code playground. \b should be backspace. It appears to be one space in run result because of the setting of sololearn compiler server and/or limitations of sololearn code playground.
30th Mar 2019, 6:37 PM
Gordon
Gordon - avatar
+ 2
By the way, you should add a checking in the for loop and do not display the last + sign for the display result to be mathematically correct.
30th Mar 2019, 6:39 PM
Gordon
Gordon - avatar
+ 1
Gordon I didn't know that either before TBH, and I meant that link for the OP to read rather than you, as \b is not a well-known escaped character, at least not a common one we found. I was thinking the original code author meant to use the backspace to erase the last '+' but since implementation was dependent, a space was what we saw as output : )
30th Mar 2019, 7:25 PM
Ipang