yulya2311
Новичок
|
помогите найти ошибку-не работает Проверка гипотез //Проверка статистических гипотез, написано для TurboC 3.0 #include<math.h> #include<iostream.h> #include<conio.h> #include<stdlib.h> void main() { char exit; double n=100.0,N=100.0; double d=32767.0; double R11,R12,R21,R22; double Ots_1,Ots_2,Err; double s1,s2,z1,z2; double sr=0; double Tsr,T1,T2; double x1[100],x2[100]; do {cout<<"\nPress 'e' for exit or 'c' to continue: "; cin>>exit; if(exit=='c') {sr=0.0;//счетчик попаданий randomize(); clrscr(); cout<<" Beta distribution = Beta(1,T)"<<endl; cout<<" INPUT: T1 = "; cin>>T1; cout<<" INPUT: T2 = "; cin>>T2; Tsr=(T1+T2)/2; for (int k=1; k<=N; k++) { s1=0.0;s2=0.0; z1=0.0;z2=0.0; for (int i=1; i<=n;i++) { A: R11= rand(); R12=rand(); R21= rand(); R22=rand(); if(R11==0.0||R12==0.0||R21==0.0||R22==0.0) goto A; x1 =(-log(R11/d))/(T1+(-log(R12/d))); x2 =(-log(R21/d))/(T2+(-log(R22/d))); s1=s1+x1; s2=s2+x2; } z1=(n-s1)/s1; z2=(n-s2)/s2; if(z1>Tsr) sr++; if(z2>Tsr) sr++; } Err=sr/(2.0*N); cout<<"Error ="<<Err<<endl; getch(); }; } while(exit!='e'); cout<<"\n GOOD BYE !!! "; }
|