+ 1
what is the meaning of cout<<"\b=";
you can check the following code https://code.sololearn.com/cI84EK0elxHY/?ref=app
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 \'
+ 3
Additional reads
https://stackoverflow.com/questions/17236242/usage-of-b-and-r-in-c
+ 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.
+ 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.
+ 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.
+ 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 : )