954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

substitute of semicolon

Is it possible to print---- hello world on the screen without using semicolon( ; ) anywhere in the code...i was able to do it through MACROS..but is there anyother way??

SpS
Posting Pro
599 posts since Aug 2005
Reputation Points: 70
Solved Threads: 32
 

MACROS? What does this acronym stand for?

Use an empty while loop.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 

[Oooooh, when will these questions cease to poison new programmers...?]

Yes. Hone your Googling skills if you are out of hints. [Bonus: Google the groups. Don't make me mention comp.lang.c (ooops!).]

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

Use a different programming language :)

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
 
Use a different programming language :)


Nice Answer :lol:

SpS
Posting Pro
599 posts since Aug 2005
Reputation Points: 70
Solved Threads: 32
 
Use an empty while loop.

empty while loop did worked but stuck into infinite loop

while(cout<<"Hello World")
{
}
SpS
Posting Pro
599 posts since Aug 2005
Reputation Points: 70
Solved Threads: 32
 

Try

#include <iostream>

int main(){
        while((std::cout << "Hello World"<< std::endl) == 0){}

}


I would assume that like most things cout would return a +ive int if it has success :)

Paul.Esson
Junior Poster
181 posts since Feb 2005
Reputation Points: 21
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You