Question: I need to get this program to except a series of numbers and then repeat them back once the user has finished entering them. Can
I need to get this program to except a series of numbers and then repeat them back once the user has finished entering them. Can I do a for loop within a while loop? My code is below.
#include
using namespace std;
int entrySubmission(int);
int main() {
int numbers;
int entrySubmission(numbers);
return 0; }
int entrySubmission(int numbers);
{ cout << "Please enter a series of positive numbers. "; cout << "Please enter a zero when you have completed your entries." << endl; cin >> numbers;
while (numbers < 0) { cout << "Negative numbers are not allowed. Please enter a positive number." << endl; cin >> numbers; }
while (numbers > 0) { for (numbers = 1; numbers > 0; numbers++) { cout << numbers << "was entered." << endl; numbers++; return numbers; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
