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
|
using namespace std;
void my_statistics(double x1, double x2, double x3, double x4);
void output(double average, double standard_dev);
double x1, x2, x3, x4, average, standard_dev;
int main()
{
cout.setf(ios::fixed);
cout.precision(4);
cout<<" Input the values for x1 through x4 "<<endl;
cin>>x1>>x2>>x3>>x4;
my_statistics(x1, x2, x3, x4);
output(average, standard_dev);
return 0;
}
////////////////////////////////////////////////////
void my_statistics(double x1, double x2, double x3, double x4, double average, double standard_dev)
{
average = 0;
standard_dev = 0;
average = (x1 + x2 + x3 + x4) / 4;
standard_dev = sqrt(((x1 - average) ^ 2 + (x2 - average) ^ 2 + (x3 - average) ^ 2 +(x4 - average) ^ 2) / 3);
}
|