Wednesday

What is endl

endl :-
                endl is a keyword which is used to end the current line or terminate the present statement. And we use it if we want the next statement to be printed in the next line. And another interesting thing is that it is short form of end of line which makes it more clear that it is used to end the current line. And in program it is also used with proper syntax.

                 The syntax is:
                 
                                            #include <iostream>
                                            using namespace std;
                                            int main ( )
                                           {
                                             cout << "Hey..!" << endl << "How are you..?"; 
                                             return 0;
                                           }
       
    We will use this syntax if we want ( Hey..! ) to be printed in the first line and ( How are you..? ) to be printed in the next line. Hence, by using this basic syntax critical programs can also be prepared. 

No comments:

Post a Comment