Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Nested Loops
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ScaryRat




PostPosted: Fri Aug 06, 2010 2:03 pm   Post subject: Nested Loops

//loop 1
while (stuff) {

//loop 2
while (other stuff) {

}
code
}

Assume that "stuff" and "other stuff" are true.
In order for "code" to be ran, does "other stuff" have to be false (thus ending loop 2)?
Sponsor
Sponsor
Sponsor
sponsor
chrisbrown




PostPosted: Fri Aug 06, 2010 2:18 pm   Post subject: RE:Nested Loops

Correct.
jbking




PostPosted: Fri Aug 06, 2010 6:20 pm   Post subject: Re: Nested Loops

Unless you put a break in the inner loop which would then run the "code" part you highlight. In other words, there is more than one way to get out of a while loop.
LeeShane




PostPosted: Wed Nov 17, 2010 3:36 am   Post subject: RE:Nested Loops

see Loop goes to run until "stuff" or "other stuff" is true. you have to make it false if want to quit loop.
Both are in infinite loop
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: