Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ question (very simple question)

Status
Not open for further replies.

lGOOODl

Programmer
Joined
Dec 4, 2001
Messages
31
Location
DK
Hi,

I would like to now if there is a way to "jumb" some steps in a source code like the "GoTo" function used in Visual Basic !

-=<GOOOD>=-
 
yes you can do that.

ex.

void main()
{
Label:
cout<<&quot;Hello&quot;;

goto label;


}

===========================
label can be any name, choose one. In this case it will
create an infinite loop, cout Hello.
 
Tanks it will help me alot
 
No it won't help you. The
Code:
goto
is not something you should ever, ever use in programming. It is considered sloppy and poor programming practice.
 
They don't call it &quot;spaghetti code&quot; for nothing. Don't use it! Just use conditional statements. When would you ever need to use a goto anyway? Bad idea. Very very bad.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top