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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
const int size=56;
double R[size]={45.3, 67.8, 34.3, 51.2, 48.5, 61.3, 59.3, 65.1,
49.3, 42.4, 63.5, 69.8, 71.2, 39.8, 55.5, 53.2,
56.7, 48.8, 61.5, 51.2, 58.9, 63.1, 67.5, 62.4,
52.4, 50.2, 49.8, 56.8, 59.7, 60.4, 45.8, 43.8,
51.3, 54.8, 55.1, 52.3, 56.2, 59.7, 63.0, 46.7,
63.1, 58.2, 41.9, 59.2, 57.2, 67.3, 68.2, 38.9,
51.3, 63.8, 53.4, 58.9, 56.3, 58.9, 53.2, 56.8};
double sum=0, mean=0, max=0, min=100, range=0, sum1=0, variance=0, std=0;
//cout<<R[1]<<endl;
for(int count=0; count<=(size-1); count++)
{
// find the sumation of all the numbers
sum=sum+R[count];
// find the maximum
if (R[count]>max)
max=R[count];
// find the minimum
if (R[count] < min)
min=R[count];
// find the mean of all the numbers
mean=sum/R[count];
// find the range
range=max-min;
// find the variance
variance=range-mean/R[count];
}
for(int V=0; V<=size-1; V++)
{
sum1=sum1+( )*( );
}
variance=sum1/( );
std=sqrt(variance);
cout<<"The mean is "<<mean<<endl;
cout<<"The maximum is "<<max<<endl;
cout<<"The minimum is "<<min<<endl;
cout<<"The range is "<<range<<endl;
cout<<"The variance is "<<variance<<endl;
cout<<"The standard deviation is "<<std<<endl;
/*
double x, y, sum, diff, mul, div;
cout<<"Hello! Welcome ."<<endl<<endl;
cout<<"Today is June 12, 2012."<<endl;
cout<<"Please enter two numbers"<<endl;
cin>>x>>y;
sum=x+y;
diff=x-y;
mul=x*y;
div=x/y;
cout<<"The sum of "<<x<<" and "<<y<<" is "<<sum<<endl;
cout<<"The difference of "<<x<<" and "<<y<<" is "<<diff<<endl;
cout<<"The product of "<<x<<" and "<<y<<" is "<<mul<<endl;
cout<<"The division of "<<x<<" and "<<y<<" is "<<div<<endl;
*/
system("pause");
}
|