Where do the numbers come from?
- Are those random numbers?
- Is the user prompted for the numbers?
- Are the numbers read from a file?
- Can the numbers be in a static array?
#include <iostream>
#include <cctype>
#include <limits>
int main()
{
std::cout << "Do you want someone to do all the work for you? ";
char answer{};
std::cin >> answer;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
if (std::toupper(answer) == 'Y' ) { std::cout << "Post it in the Jobs section.\n"; }
else { std::cout << "Show what you have coded so far.\n"; }
std::cout << "Good luck.\n";
}
@Furry Guy - I like that. You're missing a do/while loop though.
@OP
Here's the best I can offer based on your very poor description.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream>
usingnamespace std;
int main()
{
int number;
do
{ // Get number from somewhere
// Output the number
cout << number << endl;
// Do something if the number has a zero in it.
// Loop until the number is zero
} while (number);
return 0;
}