Endl
endl is a manipulator in the C++ standard library used with output streams, such as std::cout. It inserts a newline character into the stream and then flushes the stream. The manipulator is defined in the header <ostream> (and is typically included via <iostream>).
Usage: It is applied with the insertion operator, for example: std::cout << "Hello" << std::endl; This writes the
By contrast, writing "\n" inserts only a newline without flushing. If a flush is desired without inserting
Guidance: in performance-sensitive code, prefer '\n' over endl unless an immediate flush is required. Use endl