Very closely related, but there are subtle differences.
A. When you strike the $ key, the program running receives a notification that you have struck the $ key. When you strike the Enter key, the program running receives a notification that you have struck the Enter key. What happens next depends entirely on what the program decides to do with that information.
B. American Standard Code For Information Interchange (ASCII) is a scheme for representing upper case and lower case letters, digits, and an assortment of special characters as numbers in the range 32 to 127; see the table on page 456 of the text. The numbers in the range 0 to 31 are called control characters and provide very primitive formatting information. Of the control characters, only three are of interest to us:
You can see the full ASCII code, including all control characters, at http://www.asciitable.com/.
ASCII began life as the code used in ASR 33 Teletype machines, which were clunky electromechanical devices akin to remotely controlled typewriters. They typed at 10 characters per second. In these machines, CR returned the carriage to the left margin, and LF advanced the paper one line; so to if you wanted the machine to start typing on a new line, you had to send it both CR and LF. (This behavior was different from that of old manual typewriters, where the "Return" lever performed both functions.)
C. A simple text file is just a string of bytes, which is interpreted by a text editing program in accordance with the ASCII code. In a text file format, there is always some way of indicating that the following text should start on a new line. Now here is the bad news:
D. In C++, endl indicates the "newline" character. But what is a "newline character"? Depends. If your C++ program is running on Windows, newline is CR/LF. On a UNIX or LINUX machine, it is LF. On a Mac, it is CR. To this very day, this situation creates headaches when transferring text files between computers of different types.
E. ASCII is a subset of the 8-bit code ISO/IEC 8859-1, also called Latin-1, which uses values 128-255 for characters, such as ü, ê, and ç, that are used in some other languages. It is also a subset of Unicode.
F. Now we can answer the original question. If you are using a text editing program and strike Enter, the program puts a "newline" in the text being edited. But if the program is just asking you to enter one line of code in a blank, Enter will probably be interpreted as meaning that you have finished typing the line, and no newline will be involved. As I noted in paragraph A, it all depends on the program!