how do i count the number of values entered

write a program that reads ten integer numbers and outputs the number of inputs which are greater than 50, equal to 50, and less than 50. the program should also display the average of all the numbers greater than 50 and the average of all number less than 50.

this is what i have so far and im not sure how to get the program to count the number of integers entered.


#include <iostream>
using namespace std;

int main(int argc, const char * argv[])
{

//initialise variables
int a, b, c, d, e, f, g, h, i, j;

//ask user to input 10 values seperated by commas
printf("enter 10 values\n");
scanf ("%d, %d, %d, %d, %d, %d, %d, %d, %d, %d", &a, &b, &c, &d, &e, &f, &g, &h, &i, &j);

//program will output the number of values less than 50

//program will output the number of values equal to 50

//program will output the number of values more than 50

//program will get the average number less than 50

//program will get the average number more than 50






return 0;
}
You don't need to store the 10 values at all. Use a looping structure and just do the calculations as the user input the values.

Also, if you are allowed to use C++, why are you trying to limit yourself to C? You're only making things harder on yourself.
Topic archived. No new replies allowed.