endl is more than just an alias for the \n character. When you send something to cout (or any other output stream), it does not process and output the data immediately. For example:
cout << "Hello, world!";
someFunction();
In the above example, there's is some chance that the function call will start to execute before the output is flushed. Using endl you force the flush to take place before the second instruction is executed. You can also ensure that with the ostream::flush function.