Friday, 11 September 2015

Printing Statement Without 'semicolon(;)'












Generally, we use 'cout' to print anything on the screen in c++ language. For example :
To print "Hello Everyone", we use the statement as:

cout<<"Hello Everyone \n";

And we have to terminate the statement with 'semicolon(;)'.

Can we print this Statement without using terminating it with ';' ??

Yesss.. we can do such thing by the following code :

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
   clrscr();
 if(cout<<"Hello Everyone")      //printing without ';'
{

}
system("pause");
}

So, this code will print the line "Hello Everyone" without using the semicolon(;).

No comments:

Post a Comment