Hi,
I'm got to input 12 values and find the maximum, minimum and average value, i've
done the maximum, but can't do the min or average, i've spent a couple of hours trawling the web and looking over the
code but nothing seems to work
heres the part of the code i'm having trouble with-
int maxtermtemp;
int mintermtemp;
int sum=0;
int average=0;
cout<<"\nThis is Terminal\n";
for(int count=0;count<12;count++) //Input Terminal Temperatures
{
cout<<"Enter temp for "<<month[count]<<"=";
cin>> temp[count];
}
for(count=0;count<12;count++) //Maximum Terminal Temperature
{
if (maxtermtemp<temp[count])
maxtermtemp=temp[count];
}
cout<<"\nThe maximum temperature for the terminal is "<< maxtermtemp <<" degrees.\n\n";
for(count=0;count<12;count++) //Minimum Terminal Temperature
{
if(mintermtemp>temp[count])
mintermtemp=temp[count];
}
cout<<"\nThe minimum temperature for the terminal is "<<mintermtemp<<" degrees.\n\n";
for(count=0;count<12;count++) //Average Terminal Temperature
{
sum= sum + temp[count];
average=sum/12;
cout<<"Average: "<<average;
}
The maximum value is correct, but
the minimum value is about negative 9 million,
and the average comes out several times, with ascending values,
any help would be really appreciated!!!
Thanks
Lenny