T
tea-jay
hi again ..
well i do write the code but it doesnt work
i really dont what to do ?
this is my code
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
void generate (int x[],int n);
void statistic (int x[],int n,double& m,double& d);
void result (double& m, double& d);
int main()
{
//declar the variables
int x[10];
double m,d;
int n=10;
//call functions
generate(x,n);
statistic(x,n,m,d);
result(m,d);
return 0;
}
// end of main
void generate (int x[],int n)// the function no.1
{
for(int i =1;i<10;i++) //using for loop
{
x= (rand()%(15-5+1))+5;
cout<<x; // cout the array
cout<<endl;
}
}
void statistics (int x[],int n,double & m,double & d)
{
int sum=0;
int i;
int z;
for(i=0;i<n;i++)
{
sum=sum+x;
}
m = 1.0*sum/n;
z=pow(x-m,2);
d=sqrt(z)/n;
}
void result (double& m,double& d) // the output of m&d
{
cout<<"The mean value is: "<< m <<endl;
cout<<"The standard deviation is :"<<d<<endl;
}
well i do write the code but it doesnt work
i really dont what to do ?
this is my code
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
void generate (int x[],int n);
void statistic (int x[],int n,double& m,double& d);
void result (double& m, double& d);
int main()
{
//declar the variables
int x[10];
double m,d;
int n=10;
//call functions
generate(x,n);
statistic(x,n,m,d);
result(m,d);
return 0;
}
// end of main
void generate (int x[],int n)// the function no.1
{
for(int i =1;i<10;i++) //using for loop
{
x= (rand()%(15-5+1))+5;
cout<<x; // cout the array
cout<<endl;
}
}
void statistics (int x[],int n,double & m,double & d)
{
int sum=0;
int i;
int z;
for(i=0;i<n;i++)
{
sum=sum+x;
}
m = 1.0*sum/n;
z=pow(x-m,2);
d=sqrt(z)/n;
}
void result (double& m,double& d) // the output of m&d
{
cout<<"The mean value is: "<< m <<endl;
cout<<"The standard deviation is :"<<d<<endl;
}