\n is used when programming in C++

It can be used in a cout statement to cause the cursor to advance to a new line.

It works as a line feed or as the [Enter] key on a keyboard.

A typical line of code might look like this:

cout << "Hello World!\n"; would print

Hello World!

on the screen and then advance the cursor to the next line under Hello World!.

If the \n is not used then the cursor would remain on the same line just to the right of Hello World!