-->

WAP to understand endl manipulator

// program to understand endl manipulator
#include <iostream>  //header file
using namespace std; //to handle all standard characters/functions,reserved words  used in program. we do not use in turboc++ compiler

int main()
{
    cout<<"first line"<<endl;// cout is an object and is pre-defined. It is responsible for output stream.
                             // endl is used to feed a line in stream and is called manipulator. It works in same manner as \n does in program.
                            // we can put \n in single quote or double quote.
    cout << "second line\n";
    cout<<"third line"<<"\n"<<"or"<<endl;
    cout<<"fourth line"<<'\n';
    return 0;
}

No comments:

Post a Comment