C++ Manipulator endlC++ manipulator endl function is used to insert a new line character and flush the stream. Working of endl manipulator is similar to '\n' character in C++. It prints the output of the following statement in the next line. SyntaxParameteros: Output stream object affected. Return valueIt returns argument os. Data RacesModifies the stream object os. If we try to concurrent access to the same stream object, then it may cause data races, except for the standard stream objects cerr, cout, wcout, clog, wcerr and wclog when these are synchronized with stdio. Exception SafetyObject os is in a valid state, if any exception is thrown. Example 1Let's see the simple example to demonstrate the use of endl: Output: Hello World! Example 2Let's see another simple example: Output: Enter your roll number: 22 Hello roll number 22 Welcome to your new class!! Example 3Let's see another simple example: Output: 100 3.14 314 Example 4Let's see another simple example: Output: 435 ms passed 894 ms passed 1326 ms passed 1747 ms passed 2178 ms passed
Next TopicC++ Manipulator
|