PLEASE help!!! .txt into array with stddev and mean functions trouble

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?


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
#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;

}
Last edited on
Topic archived. No new replies allowed.