Find MIN, MAX, and Average PLEASE HELP!

For our homework assignment we have to write a program that asks the user for a list of 20 integer numbers. The program should output
the maximum and minimum values, and real average from the list.

This is what I have so far but everytime I try to add in average I get an error. Please help its due tomorrow

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  #include <iostream>
using namespace std;
int main()
{
	int data, num, count, average;
	int max = INT_MIN, min = INT_MAX;
	int sum = INT_SUM;

	cout << "Enter the number on integers" << endl;
	cin >> num;

	for (int count = 0; count < num; ++count)
	{
		cout << "please enter number" << count << endl;
		cin >> data;

		if (data < min)
		{
			min = data;
		}
		if (data > max)
		{
			max = data;
		}
		average = sum / count;
	}
	cout << " the smallest numeber is: " << min << endl;
	cout << "the largest number is: " << max << endl;

	return 0;
}
Don't calculate the average yet. First calculate the sum of the input values and print it after printing the max. Can you do that?
To find the sum would I just
Sum+=data?
First set sum to 0.

Then sum+=data;

I would also suggest you change the data type of average from int to double.
Topic archived. No new replies allowed.