How do I put std dev and mean funtions in this problem? I need to put this into
ID: 1858762 • Letter: H
Question
How do I put std dev and mean funtions in this problem?I need to put this into my program:
double mean(double x[], int n);
double stddev(double x[], int n);
Can you help me?
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main(int argc, char *argv[])
{
int N;
cout << "Please enter the number of numbers: ";
cin >> N;
float a[N];
double b[3][2];
double c[5];
ifstream input_file;
input_file.open("randomData.txt"); // open the input file
//******** Input ***********
for (int i=0;i<N;i++)
input_file >> a[i];
int l,k;
for (k=0;k<=2;k++)
{ for (l=0;l<=1;l++)
{
input_file >> b[k][l];
cout << b[k][l] << endl;
};
};
for (int i=0;i<4;i++)
input_file >> c[i] ;
c[4] = 12.7;
c[5] = 7.0;
cout << "Vector A = " << a[0] << " " << a[1] << " " << a[2] << endl;
for (int i=0;i<=2;i++)
{ for (int j=0;j<=1;j++)
{ cout << b[i][j] << " ";}
; cout << endl;
};
cout << c[0] << " " << c[1] << " " << c[2] << endl;
cout << c[4] << " " << c[5] << endl;
input_file.close();
system("PAUSE");
return EXIT_SUCCESS;
}
How do I put std dev and mean funtions in this problem?
I need to put this into my program:
double mean(double x[], int n);
double stddev(double x[], int n);
Can you help me?
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main(int argc, char *argv[])
{
int N;
cout << "Please enter the number of numbers: ";
cin >> N;
float a[N];
double b[3][2];
double c[5];
ifstream input_file;
input_file.open("randomData.txt"); // open the input file
//******** Input ***********
for (int i=0;i<N;i++)
input_file >> a[i];
int l,k;
for (k=0;k<=2;k++)
{ for (l=0;l<=1;l++)
{
input_file >> b[k][l];
cout << b[k][l] << endl;
};
};
for (int i=0;i<4;i++)
input_file >> c[i] ;
c[4] = 12.7;
c[5] = 7.0;
cout << "Vector A = " << a[0] << " " << a[1] << " " << a[2] << endl;
for (int i=0;i<=2;i++)
{ for (int j=0;j<=1;j++)
{ cout << b[i][j] << " ";}
; cout << endl;
};
cout << c[0] << " " << c[1] << " " << c[2] << endl;
cout << c[4] << " " << c[5] << endl;
input_file.close();
system("PAUSE");
return EXIT_SUCCESS;
}
Explanation / Answer
include using namespace std; #include int main() { int n, count; float x, sum, avg, vari, sd; sum = 0; cout > n; for (count=1; count x; sum = sum + x; } //end for avg = sum / n; //output coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.