I just need help or at least a few pointers on how to get the computer to go through numbers 1-2000000000 and tell me which numbers contain the number seven. And if someone could also help me fix the major loop at the end because i keep getting an error message that my bool 'again' isn't being initialized.
#include <iostream>
usingnamespace std;
intconst MINIMUM_VALUE = 0;
int main(void)
{
//// Prompt For Amount of Special Numbers ////
while (true)
{
//// User Input ////
while (true)
{
int howManyNumbers;
cout << "How many really interesting numbers would you like to see? ";
cin >> howManyNumbers;
cin.ignore(999,'\n');
if ( cin.fail() )
{
cin.clear ();
cout << endl;
cout << "Please enter an integer." << endl;
cout << endl;
cin.ignore(999,'\n');
continue;
}
elseif ( howManyNumbers < 0)
{
cout << endl;
cout << "Value out of range. Please enter a value within the range of " << endl;
cout << "[ " << MINIMUM_VALUE << "..." << INT_MAX << " ]." << endl;
cout << endl;
continue;
}
elseif ( howManyNumbers == 0 )
return 0;
break;
}
//// Process ////
/// need to get the computer to recognize all of the interesting and very interesting numbers. so let's start with just numbers that have a seven seeing as seven is the number of interest.
//// do while loop?
//// Output ////
cout << " The first really interesting number is " ;
cin.ignore(999,'\n');
int interestingNumber;
cout << " It is the " << interestingNumber << "th interesting number." << endl;
cin.ignore(999,'\n');
//// Reinitiate Program? ////
// 2 Finish
bool again;
while (true)
{
int againResponse;
cout << endl;
cout << "How many more interesting numbers would you like to see? ";
cin >> againResponse;
cin.ignore(999,'\n');
if ( cin.fail () )
{
cin.ignore(999,'\n');
cout << endl;
cout << "Please enter an integer. " << endl;
}
elseif ( againResponse < 0 )
{
cout << endl;
cout << "Value out of range. Please enter a value within the range of " << endl;
cout << "[ " << MINIMUM_VALUE << "..." << INT_MAX << " ]." << endl;
continue;
}
elseif ( againResponse == 0 )
{
again = false;
break;
}
else
again = true;
break;
}
if ( !again ) break;
}
}