// Mr. Minich
// Computer Science Using C++
// Ch. 8 Demo Program #3
// January 30, 2000
// Purpose - to illustrate the use of determinant, indeterminant, and nested loops.
#include <iostream.h>
int main()
{
int loopVariable = 0; // loop variable
int i = 0; // loop variable
while (loopVariable < 10)
{
cout << loopVariable << endl;
loopVariable++;
if (loopVariable == 5)
{
break;
}
}
// What values will be printed by the loop above?
for (i = 1; i < 10; i++)
{
loopVariable = 1;
do
{
cout << (loopVariable + i) << 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