Hi, I need to write a program that asks for a series of numbers, and when 0 is entered I need it to display the following:
the number of integers in the series
the average of the integers
the largest and smallest integer
the difference between the largest and smallest.
so far this is what I have:
#include <iostream.h>
main ()
{
int num[1];
int j = -1;
do
{
cout << "enter a number ";
cin >> num[1];
j++;
if (num[1] == 0)
{break;}
}
while (1);
cout << num[1] << endl;
cout << j;
return 0;
}
I know that the code is pretty bad but I'm pretty new at this.
j calculates the ammount of times an integer was entered.
so I guess i have a little done. What I'm having trouble with is figuring out a way to keep track of which numbers were entered. If i could just figure that out it looks like the rest should just click.
thanx