fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3. #define G 9.81
  4. #define PI 3.1416
  5. #define V 1.0
  6. #define AL 1.0
  7. #define AL0 1.0
  8. #define AL00 1.0
  9. #define ELZERO 0
  10. #define T 0
  11. #define TOL 0.0002
  12. #define PSI 0.1
  13. #define HV -7.2
  14. #define IPR 1
  15. #define K 0
  16. #define KDV 3.69
  17. #define KIT 12
  18. #define JPR 10
  19. #define TC 0.7
  20. #define EM 1.2
  21. #define DT 0.003
  22. #define TM 1.5
  23. #define HR 72
  24. #define QR 0.008
  25. #define NR 1450
  26. #define TR 57.2
  27. #define GDD 11.77
  28. #define M 3
  29. int I,J,NN,NNN,KI,II;
  30. float B[5],R[5],F[5],N[5],N1[5],AA[5],AR[5],DH[5],ELL[5],XSIN[5],Y0[];
  31. float C[4],X[67],RNSS[4],WWH[19],WWB[19];
  32. float RNS[4][4],RNS1[4][4],RNS2[4][4],HHHH[4][19],BBBB[4][19];
  33. float H[5][50],Q[5][50],HP[5][50],QP[5][50],Z[5][50];
  34. float XX[67],WH[67],WB[67],WHH[4][19],WBB[4][19];
  35. float DX,NL,XN,DH2,C31,KK,A1,A0,F1,DF,B1,B0,BET0,TP,NP,DDH,Q0,V000,V00,V0,TA,NM,CM,CP,F2,F2V,F2A,DAL,DV;
  36. float BET,DDX,IBIG,ABIG,SIZE,CBIG,RATI0,RN,TI,C0,C1,C2,Y;
  37. float EL[5]={20,42,52,0,0},XL[5]={25,26,15,0,0},NS[5]={90,260,530,950,0},A[5]={1311,1311,1311,0,0},D[5]=
  38.  
  39. {0.106,0.106,0.106,0,0};
  40. int main( )
  41. { DX=PI/44;
  42. for(I=0;I<34;I++)
  43. { J=34+I;XX[I]=(I-1)*DX;XX[J]=(J-1)*DX; }
  44.  
  45.  
  46.  
  47. for(J=0;J<M;J++)
  48. { AA[J]=A[J];
  49. NL=XL[J]/((1+PSI)*A[J]*DT);
  50. N[J]=XL[J]/((1-PSI)*A[J]*DT);
  51. if(NL==N[J])
  52. N1[J]=N[J]+1;
  53. XN=XL[J]/(A[J]*DT);
  54. N[J]=XN;
  55. if((XN-N[J])>0.5)
  56. N[J]=N[J]+1;
  57. if(N[J]==0)
  58. printf("程序终止");
  59. N[J]=(int)(XN+0.5);
  60. A[J]=XL[J]/(N[J]*DT);
  61. N1[J]=N[J]+1;
  62. ELL[J]=EL[J]-ELZERO;
  63. NN=N1[J];
  64. for(I=0;I<NN;I++)
  65. { if(J>1)
  66. { Z[J][I]=(I-1)*ELL[J]/XL[J]; XSIN[J]=ELL[J]/XL[J]; }
  67. else { Z[J][I]=(I-1)*(ELL[J]-ELL[J-1])/N[J]+ELL[J-1];
  68. XSIN[J]=(ELL[J]-ELL[J-1])/XL[J]; }
  69. AR[J]=0.25*PI*D[J]*D[J];
  70. B[J]=A[J]/(G*AR[J]);
  71. R[J]=F[J]*XL[J]/(2*G*AR[J]*AR[J]*D[J]*N[J]);
  72. C=C+N[J]*R[J]*QR*QR; }
  73.  
  74.  
  75. DH2=KDV*QR*QR/(2*G*AR[1]);
  76. C31=GDD*NR*PI/(60*G*TR*DT);
  77. C=C+DH2;
  78. X=PI+atan(V);
  79. I=(int)(X/DX+1);
  80. KK=0;
  81. A1=(WH[I+1]-WH[I])/DX;
  82. A0=WH[I+1]-A1*I*DX;
  83. for(KI=1;KI<KIT;KI++)
  84. { F1=-ELL[M]-C*V*V+HR*(1+V*V)*(A0+A1*X);
  85. DF=-2*C*V+HR*(2*V*(A0+A1*X)+A1);
  86. V=V-F1/DF;
  87. X=PI+atan(V);
  88. II=(int)(X/DX+1);
  89. if(II==I)
  90. { B1=(WB[I+1]-WB[I])/DX;
  91. B0=WB[I+1]-B1*I*DX;
  92. BET0=(1+V*V)*(B0+B1*X);
  93. TP=BET0*TR;
  94. NP=NR; }
  95. else { KK=KK+1; }
  96. }
  97.  
  98.  
  99.  
  100.  
  101. DDH=0;
  102. Q0=V*QR;
  103. V000=V;
  104. V00=V;
  105. V0=V;
  106. for(J=0;J<M;J++)
  107. { DH[J]=R[J]*Q0*Q0;
  108. DHH=DHH+DH[J]*N[J];
  109. H[0][0]=ELL[2]+DHH;}
  110.  
  111. for(J=0;J<M;J++)
  112. { NN=N1[J];
  113. NNN=N1[J-1];
  114. for(I=0;I<NN;I++)
  115. { Q[J][I]=Q0;
  116. if(J>1)
  117. H[J][I]=H[J-1][NNN];
  118. else H[J][I]=H[J][I]-I*DH[J]; }
  119. }
  120.  
  121.  
  122.  
  123.  
  124. TA=1;
  125. NM=N[M];
  126. BET=BET0;
  127. if(T>(TM+2*DT))
  128. printf("程序终止");
  129. else{ T=T+DT;
  130. K=K+1;
  131. for(J=0;J<M;J++)
  132. { NN=N[J];
  133. NNN=N[J-1];
  134. for(I=1;I<NN;I++)
  135. { CM=H[J][I+1]-Q[J][I+1]*(B[J]-R[J]*fabs(Q[J][I+1]));
  136. CP=H[J][I-1]-Q[J][I-1]*(B[J]-R[J]*fabs(Q[J][I-1]));
  137. HP[J][I]=(CM+CP)/2;
  138. QP[J][I]=(CP-HP[J][I])/B[J];}
  139.  
  140. CM=H[J][2]-Q[J][2]*(B[J]-R[J]*fabs(Q[J][2]));
  141. CP=H[J][NNN]+Q[J-1][NNN]*(B[J-1]-R[J-1]*fabs(Q[J-1][NNN]));
  142. QP[J][1]=(CP-CM)/(B[J]+B[J-1]);
  143. HP[J][1]=CM+B[J]*QP[J][1];
  144. HP[J-1][NNN]=HP[J][1];
  145. QP[J-1][NNN]=QP[J][1]; }
  146. }
  147.  
  148. CP=H[2][0]+Q[2][0]*(B[2]-R[2]*fabs(Q[2][0]);
  149. HP[2][1]=ELL[2];
  150. QP[2][1]=(CP-HP[2][1])/B[2];
  151.  
  152.  
  153. if(T>=TC)
  154. { TA=0;V=0;}
  155. else TA=pow((1-T/Tc),Em);
  156.  
  157. if(T<TC)
  158. { V=V000-3*V00+3*V0;
  159. AL=AL000-3*AL00+3*AL0;
  160. K1=0;
  161. X=PI+antn(V/AL);
  162. if(X>(1.5*PI))
  163. X=1.5*PI;
  164. if(X<0)
  165. X=0; }
  166.  
  167. I=(int)(X/DX+1);
  168. CM=H[1][2]-Q[1][2]*(B[1]-R[1]*fabs(Q[1][2]));
  169. A1=(WH[I+1]-WH[I])/DX;
  170. A0=WH[I+1]-A1*I*DX;
  171. B1=(WH[I+1]-WH[1])/DX;
  172. B0=WH[I+1]-B1*I*DX;
  173. LAP=LAP+1;
  174. F2=(AL*AL+V*V)*(B0+B1*X)+BET+C31*(AL-AL0);
  175. F2A=2*AL*(B0+B1*X)-V*B1+C31;
  176. DAL=-F2/F2A;
  177. DV=0;
  178. F1=TA*TA*(-B[1]*QR*V+HR*(AL*AL+V*V)*(A0+A1*X))-DH2*fabs(V);
  179. F1V=TA*TA*(-B[1]*QR+HR*(2*V*(A0+A1*X)+AL*A1))-2*DH2*fabs(V);
  180. F1A=TA*TA*HR*(2*AL*(A0+A1*X)-V*A1));
  181. F2=(AL*AL+V*V)*(B0+B1*X)+BET+C31*(AL-AL0);
  182. F2V=2*V*(B0+B1*X)+AL*B1;
  183. F2A=2*AL*(B0+B1*X)-V*B1+C31;
  184. DAL=(F2/F2V-F1/F1V)/(F1A/F1V-F2A/F2V);
  185. DV=-F1/F1V-DAL*F1A/F1V;
  186. AL=AL+DAL;
  187. V=V+DV;
  188. X=PI+atan(V/AL);
  189. if(X>(1.5*PI))
  190. X=1.5*PI;
  191. if(X<0)
  192. X=0;
  193. if((fabs(DAL)+fabs(DV))<(TOL/2))
  194. II=X/DX+1;
  195. if(II==I)
  196. I=II;
  197. K1=K1+1;
  198. if(K1<10)****
  199. XXX=X-I*DX;
  200.  
  201.  
  202.  
  203. QP[0][0]=V*QR;
  204. HP[0][0]=CM+B[0]*QP[0][0];
  205. V000=V00;
  206. V00=V0;
  207. V0=V;
  208. AL000=AL00;
  209. AL00=AL0;
  210. AL0=AL;
  211. BET=(AL*AL+V*V)*(B0+B1*X);
  212. TP=BET*TR;
  213. NP=AL*NR;
  214. PUMP=HR*(AL*AL+V*V)*(A0+A1*X);
  215.  
  216. for(J=0;J<M;J++)
  217. { NN=N1[J];
  218. for(I=0;I<NN;I++)
  219. { Q[J][I]=QP[J][I];
  220. H[J][I]=HP[J][I]; }
  221. }
  222.  
  223.  
  224. for(I=0;I<4;I++)
  225. { RNSS[I]=pow(SSNN,(3-I));
  226. for(J=0;J<4;J++)
  227. RNS[I][J]=pow(NS[I],(3-J)); }
  228.  
  229.  
  230. for(K=0;K<19;K++)
  231. { for(I=0;I<4;I++)
  232. { C[I]=HHHH[I][K];
  233. D[I]=BBBB[I][K]; }
  234. }
  235.  
  236.  
  237. for(I=0;I<4;I++)
  238. { for(J=0;J<4;J++)
  239. { RNS1[I][J]=RNS[I][J];
  240. RNS2[I][J]=RNS[I][J]; }
  241. }
  242.  
  243.  
  244.  
  245.  
  246. WWH[K]=A[1]*RNSS[1]+A[2]*RNSS[2]+A[3]*RNSS[3]+A[4]*RNSS[4];
  247. WWH[K]=B[1]*RNSS[1]+B[2]*RNSS[2]+B[3]*RNSS[3]+B[4]*RNSS[4];
  248.  
  249. DDX=3.1416/44;
  250. for(K=0;K<67;K++)
  251. {
  252. X[K]=K*DDX; }
  253.  
  254. for(K=0;K<N;K++)
  255. { BIG=fabs(A[K][K]);
  256. IBIG=K;
  257. for(I=K;I<N;I++)
  258. { SIZE=fabs(A[I][K]);
  259. if(SIZE>100)
  260. BIG=SIZE;
  261. IBIG=I; }
  262. }
  263.  
  264. if(K==IBIG)
  265.  
  266. for(J=K;J<N;J++)
  267. { ABIG=A[IBIG][J];
  268. A[IBIG][J]=A[K][J];
  269. A[K][J]=ABIG;
  270. CBIG=C[IBIG];
  271. C[IBIG]=C[K];
  272. C[K]=CBIG; }
  273.  
  274.  
  275. for(I=0;I<N;I++)
  276. { RATIO=A[I][K]/A[K][K];
  277. for(J=K;J<N;L++)
  278. { A[I][J]=A[I][J]-RATIO*A[K][J];}
  279. C[I]=C[I]-RATIO*C[K]; }
  280.  
  281.  
  282. for(K=0;K<N;K++)
  283. { X[K]=C[K]/A[K][K]; }
  284.  
  285. for(I=0;I<N;I++)
  286. { X[I]=0; }
  287.  
  288. RN=N;
  289. H=(B-A)/RN;
  290. I=(X-A)/H+0.5;
  291.  
  292. if(I>1)
  293. I=1;
  294. else if(I>(N-2))
  295. TI=1;
  296. else I=N-2;
  297. T=(X-A)/H-TI;
  298. C0=0.5*T*(T-1);
  299. C1=1-T*T;
  300. C2=0.5*T*(T+1);
  301. Y=C0*Y0[I]+C1*Y0[I+1]+C2*Y0[I+2];
  302. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'main':
prog.c:72:12: error: invalid operands to binary + (have 'float *' and 'double')
         C=C+N[J]*R[J]*QR*QR;                             }
            ^
prog.c:77:10: error: invalid operands to binary + (have 'float *' and 'float')
       C=C+DH2;
          ^
prog.c:78:8: error: assignment to expression with array type
       X=PI+atan(V);
        ^
prog.c:79:16: error: invalid operands to binary / (have 'float *' and 'float')
       I=(int)(X/DX+1);
                ^
prog.c:84:19: error: invalid operands to binary * (have 'float *' and 'double')
     { F1=-ELL[M]-C*V*V+HR*(1+V*V)*(A0+A1*X);
                   ^
prog.c:84:41: error: invalid operands to binary * (have 'float' and 'float *')
     { F1=-ELL[M]-C*V*V+HR*(1+V*V)*(A0+A1*X);
                                         ^
prog.c:85:12: error: invalid operands to binary * (have 'int' and 'float *')
       DF=-2*C*V+HR*(2*V*(A0+A1*X)+A1);
            ^
prog.c:85:31: error: invalid operands to binary * (have 'float' and 'float *')
       DF=-2*C*V+HR*(2*V*(A0+A1*X)+A1);
                               ^
prog.c:86:8: error: lvalue required as left operand of assignment
       V=V-F1/DF;
        ^
prog.c:87:8: error: assignment to expression with array type
       X=PI+atan(V);
        ^
prog.c:88:17: error: invalid operands to binary / (have 'float *' and 'float')
       II=(int)(X/DX+1);
                 ^
prog.c:92:27: error: invalid operands to binary * (have 'float' and 'float *')
        BET0=(1+V*V)*(B0+B1*X);
                           ^
prog.c:108:6: error: 'DHH' undeclared (first use in this function)
      DHH=DHH+DH[J]*N[J];
      ^
prog.c:108:6: note: each undeclared identifier is reported only once for each function it appears in
prog.c:129:9: error: lvalue required as left operand of assignment
 else{  T=T+DT;
         ^
prog.c:130:9: error: lvalue required as left operand of assignment
        K=K+1;
         ^
prog.c:148:51: error: expected ')' before ';' token
        CP=H[2][0]+Q[2][0]*(B[2]-R[2]*fabs(Q[2][0]);
                                                   ^
prog.c:181:29: error: invalid operands to binary * (have 'float' and 'float *')
        F2=(AL*AL+V*V)*(B0+B1*X)+BET+C31*(AL-AL0);
                             ^
prog.c:182:22: error: invalid operands to binary * (have 'float' and 'float *')
        F2V=2*V*(B0+B1*X)+AL*B1;
                      ^
prog.c:183:23: error: invalid operands to binary * (have 'float' and 'float *')
        F2A=2*AL*(B0+B1*X)-V*B1+C31;
                       ^
prog.c:184:23: error: 'F1V' undeclared (first use in this function)
        DAL=(F2/F2V-F1/F1V)/(F1A/F1V-F2A/F2V);
                       ^
prog.c:184:29: error: 'F1A' undeclared (first use in this function)
        DAL=(F2/F2V-F1/F1V)/(F1A/F1V-F2A/F2V);
                             ^
prog.c:186:10: error: lvalue required as left operand of assignment
        AL=AL+DAL;
          ^
prog.c:187:9: error: lvalue required as left operand of assignment
        V=V+DV;
         ^
prog.c:188:9: error: assignment to expression with array type
        X=PI+atan(V/AL);
         ^
prog.c:189:12: error: invalid operands to binary > (have 'float *' and 'double')
        if(X>(1.5*PI))
            ^
prog.c:190:9: error: assignment to expression with array type
        X=1.5*PI;
         ^
prog.c:192:9: error: assignment to expression with array type
        X=0;
         ^
prog.c:194:12: error: invalid operands to binary / (have 'float *' and 'float')
        II=X/DX+1;
            ^
prog.c:197:8: error: 'K1' undeclared (first use in this function)
        K1=K1+1;
        ^
prog.c:199:8: error: 'XXX' undeclared (first use in this function)
        XXX=X-I*DX;
        ^
prog.c:199:13: error: invalid operands to binary - (have 'float *' and 'float')
        XXX=X-I*DX;
             ^
prog.c:208:8: error: 'AL000' undeclared (first use in this function)
        AL000=AL00;
        ^
prog.c:209:12: error: lvalue required as left operand of assignment
        AL00=AL0;
            ^
prog.c:210:11: error: lvalue required as left operand of assignment
        AL0=AL;
           ^
prog.c:211:30: error: invalid operands to binary * (have 'float' and 'float *')
        BET=(AL*AL+V*V)*(B0+B1*X);
                              ^
prog.c:214:8: error: 'PUMP' undeclared (first use in this function)
        PUMP=HR*(AL*AL+V*V)*(A0+A1*X);
        ^
prog.c:214:34: error: invalid operands to binary * (have 'float' and 'float *')
        PUMP=HR*(AL*AL+V*V)*(A0+A1*X);
                                  ^
prog.c:225:21: error: 'SSNN' undeclared (first use in this function)
       { RNSS[I]=pow(SSNN,(3-I));
                     ^
prog.c:230:13: error: lvalue required as left operand of assignment
        for(K=0;K<19;K++)
             ^
prog.c:230:22: error: lvalue required as increment operand
        for(K=0;K<19;K++)
                      ^
prog.c:250:13: error: lvalue required as left operand of assignment
        for(K=0;K<67;K++)
             ^
prog.c:250:22: error: lvalue required as increment operand
        for(K=0;K<67;K++)
                      ^
prog.c:254:13: error: lvalue required as left operand of assignment
        for(K=0;K<N;K++)
             ^
prog.c:254:21: error: lvalue required as increment operand
        for(K=0;K<N;K++)
                     ^
prog.c:255:8: error: 'BIG' undeclared (first use in this function)
     {  BIG=fabs(A[K][K]);
        ^
prog.c:255:21: error: subscripted value is neither array nor pointer nor vector
     {  BIG=fabs(A[K][K]);
                     ^
prog.c:257:17: warning: comparison between pointer and integer
        for(I=K;I<N;I++)
                 ^
prog.c:258:22: error: subscripted value is neither array nor pointer nor vector
     {  SIZE=fabs(A[I][K]);
                      ^
prog.c:266:17: warning: comparison between pointer and integer
        for(J=K;J<N;J++)
                 ^
prog.c:267:14: error: array subscript is not an integer
      { ABIG=A[IBIG][J];
              ^
prog.c:268:9: error: array subscript is not an integer
        A[IBIG][J]=A[K][J];
         ^
prog.c:268:23: error: subscripted value is neither array nor pointer nor vector
        A[IBIG][J]=A[K][J];
                       ^
prog.c:269:12: error: subscripted value is neither array nor pointer nor vector
        A[K][J]=ABIG;
            ^
prog.c:270:14: error: array subscript is not an integer
        CBIG=C[IBIG];
              ^
prog.c:271:9: error: array subscript is not an integer
        C[IBIG]=C[K];                   
         ^
prog.c:275:16: warning: comparison between pointer and integer
       for(I=0;I<N;I++)
                ^
prog.c:276:7: error: 'RATIO' undeclared (first use in this function)
     { RATIO=A[I][K]/A[K][K];
       ^
prog.c:276:17: error: subscripted value is neither array nor pointer nor vector
     { RATIO=A[I][K]/A[K][K];
                 ^
prog.c:276:25: error: subscripted value is neither array nor pointer nor vector
     { RATIO=A[I][K]/A[K][K];
                         ^
prog.c:277:16: warning: comparison between pointer and integer
       for(J=K;J<N;L++)
                ^
prog.c:277:19: error: 'L' undeclared (first use in this function)
       for(J=K;J<N;L++)
                   ^
prog.c:278:11: error: subscripted value is neither array nor pointer nor vector
     { A[I][J]=A[I][J]-RATIO*A[K][J];}                      
           ^
prog.c:278:19: error: subscripted value is neither array nor pointer nor vector
     { A[I][J]=A[I][J]-RATIO*A[K][J];}                      
                   ^
prog.c:278:33: error: subscripted value is neither array nor pointer nor vector
     { A[I][J]=A[I][J]-RATIO*A[K][J];}                      
                                 ^
prog.c:282:12: error: lvalue required as left operand of assignment
       for(K=0;K<N;K++)
            ^
prog.c:282:20: error: lvalue required as increment operand
       for(K=0;K<N;K++)
                    ^
prog.c:283:21: error: subscripted value is neither array nor pointer nor vector
     { X[K]=C[K]/A[K][K];            }
                     ^
prog.c:285:16: warning: comparison between pointer and integer
       for(I=0;I<N;I++)
                ^
prog.c:288:9: error: incompatible types when assigning to type 'float' from type 'float *'
       RN=N;
         ^
prog.c:289:8: error: assignment to expression with array type
       H=(B-A)/RN;
        ^
prog.c:290:14: error: invalid operands to binary / (have 'int' and 'float (*)[50]')
       I=(X-A)/H+0.5;
              ^
prog.c:294:12: warning: comparison between pointer and integer
  else  if(I>(N-2))
            ^
prog.c:296:9: warning: assignment makes integer from pointer without a cast
  else  I=N-2;
         ^
prog.c:297:13: error: invalid operands to binary / (have 'int' and 'float (*)[50]')
      T=(X-A)/H-TI;
             ^
prog.c:302:38: error: expected declaration or statement at end of input
                                      }
                                      ^
prog.c: At top level:
prog.c:30:66: warning: array 'Y0' assumed to have one element
 float B[5],R[5],F[5],N[5],N1[5],AA[5],AR[5],DH[5],ELL[5],XSIN[5],Y0[];
                                                                  ^
prog.c: In function 'main':
prog.c:302:38: warning: control reaches end of non-void function [-Wreturn-type]
                                      }
                                      ^
stdout
Standard output is empty