so i have a project: Programming Project #2
Positive Odd Integers
Write a C++ program that can read in a set of positive integers, then it will calculate and display the
average value of all the entered odd integers (i.e. the even integers will not be counted).
The program will then display the largest and smallest integers that were selected among the entered
odd integers.
Allow your program continues to run until the user wanted to quit.
Required output:
Number of odd integers entered:
Average value:
Largest odd integer:
Smallest odd integer:
/*
*/
#include <iostream>
using namespace std;
int main ()
{
int Integercounter;
int largest;
int smallest;
int total;
int integer;
double average;
total = 0;
Integercounter = 0;
cout << "enter a positive integer or -1 to quit: ";
cin >> integer;
while ( integer != -1)
{
total = total + integer;
Integercounter = Integercounter + 1;
cout << "enter a positive integer or -1 to quit ";
cin >> integer;
}
if (Integercounter !=0)
{
average = static_cast< double >( total ) / Integercounter;
cout << "\nNumber of " <<Integercounter << "odd integers entered: "
<< total << endl;
cout << "average value: " << average << endl;
}
else
cout << "no integers were entered" << endl;
return 0;
}
so my current issue is how do i get the program to add all integers and continue to run the program if the user wishes to continue using it