//assignment 1#include <cstdlib>#include <iostream>#include <fstream>#include <vector>using namespace std;int main(int argc, char *argv[]){ //read all the values to the vector data of type double double x; ifstream in("data.txt"); vector<double> data; while(in>>x) data.push_back(x); //compute the mean of values double mean=0; for(int i=0;i<data.size();i++) mean+=data[i]/data.size(); cout<<"mean of the values is "<<mean<<endl; //compute the variance of values double variance=0; for (int i=0; i<data.size();i++) variance+=((data[i]-mean)*(data[i]-mean))/data.size(); cout<<"variance of the value is "<<variance<<endl; //compute the maximum of values double max=data[0]; for (int i=1; i<data.size();i++) if (data[i]>max) max=data[i]; cout<<"maximum of values is "<<max<<endl; //compute the minimum of values double min=data[0]; for (int i=1;i<data.size();i++) if (data[i]<min) min=data[i]; cout<<"minimum of values is "<<min<<endl; //compute the number of values in the interval [i,i+1> for (int i=0; i<=10;i++) { int N=0; for (int j=0;j<data.size();j++) if ((data[j]>=i)&&(data[j]<i+1)) N++; cout<<"the numbers of values in the interval ["<<i<<","<<i+1<<"> is "<<N<<endl; } system("PAUSE"); return EXIT_SUCCESS;}