Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <fstream>
- #include <iostream>
- #include <istream>
- #include <cstdio>
- #include <cstdlib>
- using namespace std;
- int main () {
- setlocale(LC_ALL, "rus");
- char buff [5];
- double mas [240]={NULL};
- double summa=0.0;
- double mo=0.0;
- double dispersion=0.0;
- double delta=0.0;
- double korr[60]={NULL};
- ifstream fin;
- fin.open("c:\\test.txt");
- int i=0;
- fin.getline(buff,9);
- mas[i]=atof(buff);
- while ((buff)&&(!fin.eof())){
- i++;
- fin.getline(buff,9);
- mas[i]=atof(buff);
- }
- for (int i=0; i<60; i++) summa+=mas [i];
- mo=summa/60;
- cout << "Мат. ожидание =" << mo << endl;
- for (int i=0; i<60; i++) dispersion+= (mas[i]-mo)*(mas[i]-mo);
- dispersion=dispersion/60;
- cout << "Дисперсия =" << dispersion << endl;
- delta=sqrt(dispersion);
- cout << "Стандартное отклонение = " << delta << endl;
- cout << (mas[0]-mo)*(mas[59]-mo) << endl;
- for (int m=1; m<60; m++){
- for (int i=0; i<60-m;i++) korr[m]+=(mas[i]-mo)*(mas[i+m]-mo);
- korr[m]=korr[m]/(60-m);
- }
- ofstream graph ("c:\\graph.txt");
- for (int m=1; m<60; m++) graph <<"k(" << m <<")=" <<korr [m] << endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement