#include #include #include #include double r[50]; double o[10]; double chi=0; main(){ char c; ofstream fout; fout.open("random.data"); for(int j =0;j<5;j++) { for(int i =0;i<10;i++) { r[j*10+i]=(double)(1+rand()%100)/100; fout << r[j*10+i] << "& "; } fout << "\\\\" << endl; } for(int i=0;i<10;i++) o[i]=0; for(int i =0;i<50;i++) o[(int)floor(r[i]*10)]++; for(int i=0;i<10;i++) { cout << i << ": "<< o[i] << " "<< (o[i]-5)*(o[i]-5)/5<< endl; chi += (o[i]-5)*(o[i]-5)/5; } cout << endl << "chi " << chi; for(int i=0;i<49;i++) if(r[i]