Thanks for the help earlier, I fixed the problem i had earlier in nested loops, but now i need help creating a Do/While Loop that is a loop above all the steps above that ask the user to continue y or n and quit unless they enter y. i know how to terminate the program.
#include <iostream>
using namespace std;
int main()
{
int number, dig1, dig2, dig3;
char answer;
cout << "Enter a Positive Integer from 0 to 999." << endl;
cin >> number;
while ((number < 0) || (number > 999))
{
cout << "Error: Negative Number or Number Greater than 999\n" << "Reenter that number and continue: \n";
cin >> number; }
dig1 = number / 100;
dig2 = (number % 100 - number % 10) / 10;
dig3 = number % 10;
for ( int i = 0; i <= dig1; i++ ) {
for ( int j = 0; j <= ( ( i == dig1 ) ? dig2 : 9 ); j++ ) {
for ( int k = 0; k <= ( ( j == dig2 ) ? dig3 : 9 ); k++ )
cout<< i << j << k <<endl;
}
}
do{
cout << "Do you want to continue (y/n)?\n";
cin >> answer;
} while (answer != 'n'
cout << "goodbye!\n";
return 0;
}