Question:
C++ Programming question: Double Nested While Loop?
ArtsyGirl
2014-03-17 08:00:11 UTC
What is the basic format for a double nested while loop? How different is it from just a while loop?
Five answers:
?
2014-03-17 08:07:36 UTC
simple while loop:

While(condition)

{ statements;

}



Double nested while loop:

While(condition1)

{ statement1;

While(condition2)

{ statement2;

}

}



In nested while loop to reach statement2 both condition 1 and 2 should be fulfilled where as in single while loop there is only one condition to reach statements.
anonymous
2015-08-07 12:37:01 UTC
This Site Might Help You.



RE:

C++ Programming question: Double Nested While Loop?

What is the basic format for a double nested while loop? How different is it from just a while loop?
?
2016-11-10 04:56:15 UTC
Nested While Loops
anonymous
2016-03-14 05:16:28 UTC
First off, your data validation isn't completely correct. What if someone enters a decimal or character? They could enter 2.5 for the years, or the letter J for amount of rainfall and it would still run! Also, remove the semi-colon from the end of this line for ( int month = 1; month <= numMonths; month++ ); That should clear up all your errors. The semi-colon was ending the loop immediately. Because the loop finished there, the variable month was no longer valid for your cout statement, causing the error.
anonymous
2014-03-17 08:01:01 UTC
ok


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...