Coders Packet

Hello World without using semicolon in C++

By M Abirami

C++ Program to print something without using semicolon (;). This type of programs generally asked in Company/any competitive exams.

Generally when we use std::cout<<"" statement, we have to use a semicolon at the end. If cout is used inside an if Condition, semicolon can be avoided.

The if statement checks for condition whether the return value of std::cout<<"Hello World" is greater than 0. Cout function returns the length of the string printed. Hence the statement if (std::cout<<"Hello World") prints the string
"Hello World".

We can also print any other statement without using semicolon in program.

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by M Abirami (Abirami)

Download packets of source code on Coders Packet