Hi everyone!
I am completely new to C++ programming and am having some difficulties structuring the code for the assignment below. The code I have so far is listed below that again. I'm confused about how to declare the value(s) that will be input by user
n times. I'm also not sure what constructs to use to output the statistics listed at bottom of the assignment. ANY assistance whatsoever is highly appreciated.
Write a program that generates some basic statistics on a set of input values. The program begins by first prompting the user to specify the number of values, say n, that are to be processed. Once this value has been determined program should prompt the user to enter n values, with one prompt per value to be entered.
For each of the n values entered, the program should perform the following actions (without performing any additional output per value:
• Maintain a running total value
• Determine if the value is negative
• Determine if the value is an integer
• If the value is an integer, determine whether it is even or odd
After all of the values have been input to the program, the program should then output the following statistics concerning the input:
• The number of values entered
• The sum of the values entered
• The average of the values entered
• The number of negative values entered
• The number of even values entered
• The number of odd values entered
1 2 3 4 5 6 7 8 9 10 11 12 13
|
include <iostream>
using namespace std;
int main()
{
int loopCount;
cout << “Specify number of values to process: “;
cin >> loopCount;
while (loopCount-- > 0)
{
cout << “Enter next value: \n”;
cin >>
|