24 AnswersNew Answer
Hey! Bugs are just unintended features!
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
if i do: cout<< "\b"; it does the same
it's probably a mix of sololearn output capture system and output display, wich would introduces some quirks ^^
Mike are you challenging me. careful it might get messy. ;)
Maybe need to code yourself a few laxatives 😉
visph a sololearn easter egg ?
:D not really... I think rather a sololearn bug ;P
It's called kerning ;)
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/
yeah i know. but why is it doing that ?
seems to be any non printable characters: like '\b' is backspace. but still i wonder why would it mess up with the character spacing.
while easter egg are hidden features ^^ in both cases, they are almost unuseful... if not annoying :(
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.
It's because you had cout<< "\1"; Remove it and it works normal
It's to do with the OCT value in the ascii table
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
Fortis Militis i didnt mean to use '\1' specifically but I was trying to replicate some behavior i encountered in another code. i use '\0' at first then i tried '\1' simply because i like the "++" increment 😉. yeah i remember msdos had the first emoji ever and it was char 1. i guess microsoft keep their inventions for long time. https://en.m.wikipedia.org/wiki/Code_page_437 the microsoft charset is pretty awesome to make character based games.
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".
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" ?