They're different characters.
is carriage return, and
is line feed.
On "old" printers,
sent the print head back to the start of the line, and
advanced the paper by one line. Both were therefore necessary to start printing on the next line.
Obviously that's somewhat irrelevant now, although depending on the console you may still be able to use
to move to the start of the line and overwrite the existing text.
More importantly, Unix tends to use
as a line separator; Windows tends to use
as a line separator and Macs (up to OS 9) used to use
as the line separator. (Mac OS X is Unix-y, so uses
instead; there may be some compatibility situations where
is used instead though.)
For more information, see the Wikipedia newline article.
EDIT: This is language-sensitive. In C# and Java, for example,
always means Unicode U+000A, which is defined as line feed. In C and C++ the water is somewhat muddier, as the meaning is platform-specific. See comments for details.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…