SHARE
TWEET

Untitled

a guest Apr 18th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <string>
  4. #include <vector>
  5. #include<math.h>
  6. #include<ctime>
  7. #include<cstdlib>  
  8. using namespace std;
  9. void fillinarray(int array1[], int SIZE);
  10.  
  11. int main()
  12. {
  13.     const int SIZE = 4;
  14.     int A[SIZE];
  15.     fillinarray(A, SIZE);
  16.     system("pause");
  17.     return 0;
  18. }
  19. void fillinarray(int array1[], int SIZE)
  20. {
  21.  
  22.     for (int i = 0; i < SIZE; i++)
  23.     {
  24.         array1[i] = rand() % 10000 / 10000.0;
  25.     }
  26.     cout << array1;
  27. }
  28.  
  29. double avg(int array1[], int SIZE)
  30. {
  31.     double total = 0;
  32.     for (int i = 0; i < SIZE; i++)
  33.     {
  34.         total += array1[i];
  35.         return total / SIZE;
  36.  
  37.     }
  38. }
  39. double stdev(int array1[], int SIZE)
  40. {
  41.     double mu = avg(array1, SIZE);
  42.     double total = 0;
  43.     for (int i = 0; i < SIZE; i++)
  44.     {
  45.         total += pow(array1[i] - mu, 2);
  46.     }
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top