symbolic ASCII code meaning \ nTenline break nl\r -Enter CR Enter the original meaning is the cursor back to the beginning of the bank, R's English return, control characters can be written as CR, that is carriage return line \ n is the original meaning of the cursor line (not necessarily to the beginning of the next line), n the English newline, control characters can be written as L F, that is, the line feed in different operating systems these characters behave differently, for example, in the win system, these two characters is the original meaning of expression, in the Unix class system, the newline \ n is shown as the next line of the cursor and back to the beginning of the start, on the Mac, \ r is returned to the beginning of the bank and a line The definition of the ENTER key is related to the operating system. The usual enter is two to add together. Before the computer appeared, there was a type of telex typewriter called the teletype Model -), you can play 10 characters per second. But it has a problem, that is, when the line is finished, it will take 0.2 seconds to hit two characters. If there are new characters coming in this 0.2 seconds, then this character will be lost. So, the developers think of a way to solve this problem, is to add two after each line to end the character. One is called "carriage return", which tells the typewriter to position the printhead at the left border, and the other is called "line break", telling the typewriter to move the paper down one line. This is the origin of "line break" and "carriage return", from their English name can also be seen in one or two. Later, the computer invented, these two concepts are also like to the computer. At that time, memory was expensive, and some scientists thought it would be too wasteful to add two characters at the end of each line. So, there was disagreement. /*======================================*/\n:unix system End-of-line terminator \n\r:window system end-of-line terminator \r:mac OS system End-of-line terminator/*======================================*/A direct consequence of this is that Unix/mac system files open in Windows, all the text will become a line, while the files in Windows Unix/mac Open, at the end of each line may be more than a ^m symbol. (This is often said to see the phenomenon, Haha, the original is such) C++language Programming (Windows system) \ r is return to the beginning of the line of the bank this will overwrite the previous output of this row as follows:intMain () {cout<<"hahaha"<<"\ r"<<"Xixi" ;} Finally only show Xixi and hahaha is overwritten \ n is carriage return + line break move the cursor first to the beginning of the start and then to the next line, the beginning of the next line.intMain () {cout<<"hahaha"<<"\ n"<<"Xixi" ;} The Display Hahahaxixi
\ n and \ r