Sunday, 1 February 2015

ENDL AND \N STATEMENT IN C++

Structure of the Problem Requirements

Both the endl and '\n' are used to start a new line in C++ program, But there is a grammatically difference between these two commands. N is a string  of length 1 that get appended to namespace std . On the other hand endl flushes the buffer . In this case the main advantage of endl is that if the program crashed the stuff get printed.But if you are using just to jump in new line with endl it consume the processing power and reduce the efficiency of the program.

Source Code

#include<iostream>
using namespace std;
int main ()
{
cout<<"\t \t \t LEP Tutorials \n \n \n ";
cout<<" This New Line Start with Endl "<<endl<<endl ;
cout<<" This New Line Start with N \n \n ";
}

Output of the Program

ENDL AND \N STATEMENT IN C++

Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

0 comments:

Post a Comment