Ok i have this assignment almost complete. But after the standard deviation, i am supposed to show the minimum and maximum temperatures and the number of the position of the temperature. I just do not understand how to to that....
//Assignment 6: Computing with Arrays
//By: Curtis Davenport 2/24/08
#include <iostream>
#include <cmath>
#define MAXTEMPREADINGS 100
using namespace std;
int AveOut(float);
int SdevOut(float);
int main()
{
int i,numTemps;
float temp[MAXTEMPREADINGS];
float ave = 0.0;
float sdev = 0.0;
do
{
cout << "Enter the number of temperature readings: ";
cin >> numTemps;
if (numTemps < 1)
{
cout << "The number of readings is too LOW!!! \n";
cout << "Keep the number of readings greater than 0. \n";
}
if (numTemps > MAXTEMPREADINGS)
{
cout <<"The number of readings is too HIGH!!! \n";
cout << "Limit the number of temperature readings to 100 \n";
}
} while ((numTemps < 1) || (numTemps > MAXTEMPREADINGS));
for (i = 0;i < numTemps;i++)
{
cout << "Enter the temperature reading #" << i+1 << ": ";
cin >> temp[i];
}
for (i = 0; i < numTemps;i++)
{
ave = ave + temp[i];
}
ave = ave / numTemps;
for (i = 0; i < numTemps;i++)
{
sdev = sdev + pow((temp[i] - ave),2);
}
sdev = sdev / numTemps;
sdev = sqrt(sdev);
AveOut(ave);
SdevOut(sdev);
return 0;
}
int AveOut(float ave)
{
cout << "The Temperature average is: " << ave << "\n";
return 0;
}
int SdevOut(float sdev)
{
cout << "The class standard deviation is: " << sdev << "\n";
return 0;
}
I have the output of what it should look like attached. That is all i need help with, i just cant figure out how to do the minimum and maximum and what temperature reading number it is.....thanks for any assistance