Use of endl in C++ Language

Use of endl in C++ Language:

(1) << endlis an alternate of “\n” for inserting a new line or print output in the next line

(2) Sample C++ language code and its output, as shown:

Sample C++ language code for endl command
#include <iostream>
using namespace std;
int main() {
cout<< “My first C++ Language Line!” <<endl;
cout<< “My second C++ Language Line!”;
return 0;
}

(3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.

build code for endl in c++

(4)  After building the code, press the “Run” button, as shown.

Run endl command in c++ editor

(5) After pressing the “run” button, the output screen is opened, as shown.

C++ output screen for insert new line

(6) “endl”: Enter one “<<endl” means to insert only one line, if you enter two “<<endl<<endl” then the system inserts two lines and vice versa.


Use of SUBSTRING Function in SQL
Use of REVERSE Function in SQL
Use of REPLACE Function in SQL
LOWER (Transact-SQL)– Microsoft Docs

Leave a Reply