Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- #include <vector>
- #include<math.h>
- #include<ctime>
- #include<cstdlib>
- using namespace std;
- void fillinarray(int array1[], int SIZE);
- int main()
- {
- const int SIZE = 4;
- int A[SIZE];
- fillinarray(A, SIZE);
- system("pause");
- return 0;
- }
- void fillinarray(int array1[], int SIZE)
- {
- for (int i = 0; i < SIZE; i++)
- {
- array1[i] = rand() % 10000 / 10000.0;
- }
- cout << array1;
- }
- double avg(int array1[], int SIZE)
- {
- double total = 0;
- for (int i = 0; i < SIZE; i++)
- {
- total += array1[i];
- return total / SIZE;
- }
- }
- double stdev(int array1[], int SIZE)
- {
- double mu = avg(array1, SIZE);
- double total = 0;
- for (int i = 0; i < SIZE; i++)
- {
- total += pow(array1[i] - mu, 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement