// Mr. Minich
// CMPSC 201
// Ch. 5 Demo Program #3
// January 30, 2000
// Purpose - to illustrate the use of determinant, indeterminant, and nested loops.
#include <iostream>
using namespace std;
int main()
{
int loopVariable = 0; // loop variable
while (loopVariable < 10)
{
cout << loopVariable << endl;
loopVariable++;
if (loopVariable == 5)
{
break;
}
}
// What values will be printed by the loop above?
for (int num = 1; num < 10; num++)
{
loopVariable = 1;
do
{
cout << (loopVariable + num) << endl;
loopVariable += 2;
if (loopVariable >= 5)
{
break;
}
} while (loopVariable < 1000);
}
// This is an example of nested loops with a do loop inside
// of a for loop.
// Predict what values will be printed out. Realize though
// that the break command only breaks out of the inner do loop
// each time that it applies.
return 0;
}// end of main