New course! Every coder should learn Generative AI!
Try a free lesson+ 8
Hey! Bugs are just unintended features!
+ 9
Here's something:
cout<<"\0" // Null value
cout<<"\1" // a non printable value
cout<<"\2" // a non printable value
cout<<"\11" // horizontal tab
So the output depends on how compiler prints these non printable characters .
These all values are being treated as octal values even though they are not starting with literal 0 and It amazes me.
Here's the list of what's printable and what's non printable
https://web.itu.edu.tr/sgunduz/courses/mikroisl/ascii.html
+ 6
it's probably a mix of sololearn output capture system and output display, wich would introduces some quirks ^^
+ 5
It's called kerning ;)
+ 5
Maybe need to code yourself a few laxatives 😉
+ 4
:D
not really...
I think rather a sololearn bug ;P
+ 4
Diglett With Top Hat
like I have pointed out already :
"These all values are being treated as octal values..."
So anything not in between [0,7] is an unknown escape sequence .
here's the complete this
http://www.asciitable.com/
+ 4
Hima Yeah, after I posted that answer I played with the code a little more, and found out that you can trigger errors related to octal values, the error that the compiler throws out says "warning: octal escape sequence out of range".
Also, thanks for the link, it all makes sense now.
+ 3
while easter egg are hidden features ^^
in both cases, they are almost unuseful... if not annoying :(
+ 3
😂 good job. You have introduced colon letter spacing.
+ 2
It's because you had cout<< "\1"; Remove it and it works normal
+ 2
It's to do with the OCT value in the ascii table
+ 2
I'm unsure with that one. It could be perhaps a letter gets defaulted to a number 1 in the compiler? Or perhaps something else completely
+ 2
like Pieter Edwards said, it seems to have something to do with ascii, i tried changing the value of cout << "\1"; to something like cout << "\126"; and it printed a letter, I think it prints the letter V (it only replaces the first character of the sentence though), also, don't try changing it to values like 80 or 90 because your code will error out saying "warning: unknown escape sequence".
+ 1
Copied and pasted the code in Visual Studio 2017 and it printed out the following:
::::::::::
☺::::::::::
has contemplated the "\1" to the emoji icon!
Tested the same code in the Repl which runs on clang++-7
and it skipped the "\1" and only printed 2 rows of ":"
Did you mean to print the emoji?
what was the purpose of using the "\1" ?
+ 1
Mike 😂
+ 1
ChillPill ... I would challenge you but it may result in a new ascii emoji worse than a certain brown, smiling emoji; and pretty sure it may earn a ban from sololearn lol
+ 1
Fortis Militis how did you set path to clang??