Home »
C++ programs »
C++ manipulators programs
C++ program to demonstrate example of endl manipulator
Learn about the endl manipulator in C++, and demonstrate the use of endl manipulator using C++ program.
[Last updated : March 02, 2023]
endl Manipulator in C++
The 'endl' stands for end of line. Furthermore, it is used to take place to move the cursor to the beginning of the next line. Its working is similar to the '\n' escape sequence.
This program will demonstrate example of endl manipulator in c++ programming language.
endl manipulator program in C++
/*C++ program to demonstrate example of endl manipulator.*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << "This is line 1." << endl;
cout << "This is line 2." << endl;
cout << "This is line 3." << endl;
cout << "Word1" << endl << "Word2" << endl << "Word3" << endl;
return 0;
}
Output
This is line 1.
This is line 2.
This is line 3.
Word1
Word2
Word3