/* * @(#) smt1_4.c - Program for calculation of the hitting factor of * an air bomb (Task 1_4 at the Special Military Training course). * (c) 1996 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: ANSI C * Tested with: Borland C++ v3.1 * Last modified: 1996-12-12 19:45:00 GMT+03:00 */ #include #include #define K 12 int rnd_func(int x) { return (x*5%(1<z-b) return (exp((a-x)/k)); return 0.0; } int main() { int i,n, seed; double x,y,z,mz,sigmax,sigmay,sigmaz,l; double r_phi,r_1,phi_1,phi_2,a,b,k; double c_1,c_2; printf("Input SigmaX (SigmaX>0):\n"); scanf("%lf",&sigmax); printf("Input SigmaY (SigmaY>0):\n"); scanf("%lf",&sigmay); printf("Input C1 (C1<0):\n"); scanf("%lf",&c_1); printf("Input C2 (00):\n"); scanf("%lf",&r_phi); printf("Input r_1 (r_1>0):\n"); scanf("%lf",&r_1); printf("Input phi_1 (rad):\n"); scanf("%lf",&phi_1); printf("Input phi_2 (rad):\n"); scanf("%lf",&phi_2); printf("Input a (a>0):\n"); scanf("%lf",&a); printf("Input b (b>0):\n"); scanf("%lf",&b); printf("Input K (K>0):\n"); scanf("%lf",&k); printf("Input N (10<=N<=1000):\n"); scanf("%d",&n); printf("Input Seed [0..%d]:\n",(1<<(K-3))*3); scanf("%d",&seed); seed=(seed<<1)+(1<<(K-2))-1; phi_1=tan(M_PI_2-phi_1); phi_2=tan(M_PI_2-phi_2); l=0.0; for (i=0;i