fork download
  1. #include <stdio.h>
  2. int main (void)
  3. {
  4.  
  5. int m, m1, c,mi;
  6. double ro[7];
  7. double ro1[7];
  8. double ro2[7];
  9. double pt[7];
  10. double pl[7];
  11. double l1[7]={2.5,5.0,7.5,10.0,12.5,15.0,17.5};
  12. double l2[7]={5,10,15,20,25,30,35};
  13. double p0[7];
  14. double pstr[7];
  15. double pstr1[7];
  16. double pstr2[7];
  17. double Qcm[7];
  18. m1=5;
  19. m=9;
  20. mi=10;
  21. c=4;
  22.  
  23.  
  24. void ro(){
  25. for(int i=0;i<7;i++)
  26. ro[i]=(l1[i]+l2[i])/mi;
  27. }
  28. void ro1(){
  29. for(int i=0;i<7;i++)
  30. ro1[i]=l1[i]/mi;
  31. }
  32. void ro2(){
  33. for(int i=0;i<7;i++)
  34. ro2[i]=l2[i]/mi;
  35. }
  36. ro();
  37. ro1();
  38. ro2();
  39. int silnia(int i){
  40. if(i==0) return 1;
  41. else return i*silnia(i-1);
  42. }
  43. void p0(){
  44. double x,y,z;
  45. x=0;
  46. y=0;
  47. z=0;
  48. for(int i=0;i<c-1;i++){
  49. x+=ro[i]/silnia(i);
  50. }
  51. for(int i=0;i<m1-1;i++){
  52. y+=pow((ro[i]/c),i);
  53. }
  54. for(int i=0;i<m-m1;i++){
  55. z+=pow((ro2[i]/c),i);
  56. }
  57. for(int i=0;i<7;i++){
  58. p0[i]=pow((x+pow(ro[i],c)/silnia(c)*(y+pow(ro[i]/c,m1)*z)),-1);
  59. }
  60. }
  61. void Qcm(){
  62. for(int i=0;i<7;i++){
  63. Qcm[i]=pow(ro[i],c)/silnia(c)*pow(ro[i]/c,m1)*pow(ro2[i]/c,(c+m)-(c+m1));
  64. }
  65. }
  66.  
  67. void pstr2(){
  68. for(int i=0;i<7;i++){
  69. pstr2[i]=p0[i]*Qcm[i];
  70. }
  71. }
  72.  
  73. void pstr1(){
  74. double[] x=new double[7];
  75. double z=0;
  76. for(int i=0;i<m-m1;i++){
  77. z+=pow((ro2[i]/c),i);
  78.  
  79. }
  80. for(int i=0;i<7;i++){
  81. pstr1[i]=pow(ro[i],c)/silnia(c)*pow(ro[i]/c,m1)*z;
  82. }
  83. }
  84.  
  85. void pt(){
  86. for(int i=0;i<7;i++){
  87. pt[i]=pstr2[i]*ro2[i]/ro[i];
  88. }
  89. }
  90.  
  91. void pl(){
  92. for(int i=0;i<7;i++){
  93. pl[i]=pstr1[i]*ro1[i]/ro[i];
  94. }
  95. }
  96.  
  97. void pstr(){
  98. for(int i=0;i<7;i++){
  99. pstr[i]=pt[i]+pl[i];
  100. }
  101. }
  102.  
  103.  
  104. return 0;
  105. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:24:10: error: ‘ro’ redeclared as different kind of symbol
prog.c:6:12: note: previous declaration of ‘ro’ was here
prog.c: In function ‘ro’:
prog.c:25:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:25:9: note: use option -std=c99 or -std=gnu99 to compile your code
prog.c:26:15: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:28:10: error: ‘ro1’ redeclared as different kind of symbol
prog.c:7:12: note: previous declaration of ‘ro1’ was here
prog.c: In function ‘ro1’:
prog.c:29:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:30:16: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:32:10: error: ‘ro2’ redeclared as different kind of symbol
prog.c:8:12: note: previous declaration of ‘ro2’ was here
prog.c: In function ‘ro2’:
prog.c:33:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:34:16: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:43:10: error: ‘p0’ redeclared as different kind of symbol
prog.c:13:8: note: previous declaration of ‘p0’ was here
prog.c: In function ‘p0’:
prog.c:48:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:49:14: error: subscripted value is neither array nor pointer nor vector
prog.c:51:13: error: redefinition of ‘i’
prog.c:48:13: note: previous definition of ‘i’ was here
prog.c:51:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:52:9: warning: implicit declaration of function ‘pow’ [-Wimplicit-function-declaration]
prog.c:52:12: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:52:19: error: subscripted value is neither array nor pointer nor vector
prog.c:54:13: error: redefinition of ‘i’
prog.c:51:13: note: previous definition of ‘i’ was here
prog.c:54:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:55:12: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:55:20: error: subscripted value is neither array nor pointer nor vector
prog.c:57:13: error: redefinition of ‘i’
prog.c:54:13: note: previous definition of ‘i’ was here
prog.c:57:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:58:11: error: subscripted value is neither array nor pointer nor vector
prog.c:58:15: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:58:28: error: subscripted value is neither array nor pointer nor vector
prog.c:58:54: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:61:10: error: ‘Qcm’ redeclared as different kind of symbol
prog.c:17:8: note: previous declaration of ‘Qcm’ was here
prog.c: In function ‘Qcm’:
prog.c:62:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:63:12: error: subscripted value is neither array nor pointer nor vector
prog.c:63:16: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:63:22: error: subscripted value is neither array nor pointer nor vector
prog.c:63:45: error: subscripted value is neither array nor pointer nor vector
prog.c:63:62: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:67:10: error: ‘pstr2’ redeclared as different kind of symbol
prog.c:16:8: note: previous declaration of ‘pstr2’ was here
prog.c: In function ‘pstr2’:
prog.c:68:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:69:14: error: subscripted value is neither array nor pointer nor vector
prog.c:69:20: error: subscripted value is neither array nor pointer nor vector
prog.c:69:27: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:73:10: error: ‘pstr1’ redeclared as different kind of symbol
prog.c:15:8: note: previous declaration of ‘pstr1’ was here
prog.c: In function ‘pstr1’:
prog.c:74:14: error: expected identifier or ‘(’ before ‘[’ token
prog.c:76:8: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:77:12: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:77:20: error: subscripted value is neither array nor pointer nor vector
prog.c:80:16: error: redefinition of ‘i’
prog.c:76:16: note: previous definition of ‘i’ was here
prog.c:80:8: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:81:14: error: subscripted value is neither array nor pointer nor vector
prog.c:81:18: warning: incompatible implicit declaration of built-in function ‘pow’ [enabled by default]
prog.c:81:24: error: subscripted value is neither array nor pointer nor vector
prog.c:81:47: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:85:10: error: ‘pt’ redeclared as different kind of symbol
prog.c:9:9: note: previous declaration of ‘pt’ was here
prog.c: In function ‘pt’:
prog.c:86:10: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:87:11: error: subscripted value is neither array nor pointer nor vector
prog.c:87:20: error: subscripted value is neither array nor pointer nor vector
prog.c:87:27: error: subscripted value is neither array nor pointer nor vector
prog.c:87:33: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:91:11: error: ‘pl’ redeclared as different kind of symbol
prog.c:10:9: note: previous declaration of ‘pl’ was here
prog.c: In function ‘pl’:
prog.c:92:10: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:93:11: error: subscripted value is neither array nor pointer nor vector
prog.c:93:20: error: subscripted value is neither array nor pointer nor vector
prog.c:93:27: error: subscripted value is neither array nor pointer nor vector
prog.c:93:33: error: subscripted value is neither array nor pointer nor vector
prog.c: In function ‘main’:
prog.c:97:11: error: ‘pstr’ redeclared as different kind of symbol
prog.c:14:8: note: previous declaration of ‘pstr’ was here
prog.c: In function ‘pstr’:
prog.c:98:12: error: ‘for’ loop initial declarations are only allowed in C99 mode
prog.c:99:13: error: subscripted value is neither array nor pointer nor vector
prog.c:99:19: error: subscripted value is neither array nor pointer nor vector
prog.c:99:25: error: subscripted value is neither array nor pointer nor vector
stdout
Standard output is empty