How do I print "\n" or "\t"? Apparently neither \n nor \\n work.
How do I print "\n" or "\t"? Apparently neither \n nor \\n work.
ok, now \\n seems to be working. i swear it wasn't a second ago.
I'd say it's doing a pretty good job of it! <smile>
Seems more like self-flagellation and blaming the textbook, rather than torture by textbook, IMHO.
This seems to be more a question of notation. For example when you say to print "hello\nworld\n" what exactly do you mean? As programmers we agree on a convention that this means to print the the string "hello" on one line, then "world" on the next. This is the way the compiler interprets it. If you want to actually print the following
"hello"\n"world"\n
on a single line then the convention specifies you must type "\"hello\"\\n\"world\"\\n\n". Maybe its confusing at first but read it carefully left to right: Start-of-string, literal-", hello, literal-", literal-\, n, literal-", world, literal-", literal-\, n, newline, End-of-string.
Text-Editors with syntax highlighting can help you to digest the notation a little easier without "self-flagellation"