#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
float numbers[15];
float sum, lowest, highest;
float min, max, range, stDev, mean, median;
float above = 0, below = 0;
sum = 0;
for(int testNum = 0; testNum < 15; testNum++)
{
cout << "Please enter your 15 numbers: ";
cin >> numbers[testNum];
sum = sum + numbers[testNum];
}
mean = sum/15;
for(int testNum = 0; testNum < 15; testNum++)
{
if(numbers[testNum] < mean)
{
below++;
}
else if(numbers[testNum] > mean)
{
above++;
}
}
lowest = numbers[0];
for(int testNum = 0; testNum < 15; testNum++)
{
if(numbers[testNum] < lowest)
lowest = numbers[testNum];
}
highest = numbers[0];
for(int testNum = 0; testNum < 15; testNum++)
{
if(numbers[testNum] > highest)
highest = numbers[testNum];
}
cout << "Your mean is: " << sum/15 << endl;
cout << "Your range is: " << highest-lowest << endl;
cout << "Your median is: " << median << endl;
cout << "Your standard deviation is: " << stDev << endl;
cout << "Your maximum is: " << highest << endl;
cout << "Your minimum is: " << lowest << endl;
return 0;
}
I am also supposed to find and print out the median and standard deviation, but how would i do that? The user can enter any order and any kind of numbers, so how can i separate them to find a median with code? I also dont know how i would code the standard deviation... Any help would be greatly appreciated!

New Topic/Question
Reply



MultiQuote





|