Write a program that initializes a vector with the following array values.
int arr[] = {1, 6, 2, 9, 12, 15, 33, 28};
Compute the average value, and then output each value along with its deviation (+/‐) from
the average.
What i have so far is only the average...
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
double sum = 0;
double average = 0;
double array[ ] = {1, 6, 2, 9, 12, 15, 33, 28};
for (int i = 0; i < 8; i++)
sum+= array[i];
average = sum/8;
cout << "Average:" << average << endl;
}
But i can't figure out the second part... to do the deviation of each number from the array and figure out how far it is from the average...
I'm really new to this and any assistance would be great!!!
Thanks