fork download
  1. #include <stdio.h>
  2. typedef struct Fraction { //定義分數的結構變數,基本有分母與分子兩個變數
  3. int dividend; //被除數
  4. int divisor; //除數
  5. }Fra;
  6.  
  7.  
  8.  
  9.  
  10. void FraInfo(int dividend,int divisor,Fra m,Fra n) {
  11. int i=dividend;
  12. int j=divisor;
  13. int a = 0;
  14. int b = 1;
  15. if (i>0) {
  16. for (i = 1; i>0; i++) {
  17. printf("%d/n",i);
  18. i=dividend
  19. a+= i;
  20. printf("%d/n",a);
  21. a=dividend;
  22. }
  23. }
  24. else {
  25. if (i<0){
  26. for (i = -1; i<0; i--) {
  27. printf("%d/n",i);
  28. i=dividend;
  29. a -= i;
  30. printf("%d/n",a);
  31. i=dividend;
  32. }
  33. }
  34. }
  35. if(j>0){
  36. for (j = 1; j>0; j++) {
  37. printf("%d/n",j);
  38.  
  39. }
  40.  
  41. }return 1;
  42. }
  43. if(j>0){
  44. for (j = 1; j>0; j++) {
  45. return j;
  46. }return 1;
  47. }
  48. }
  49.  
  50. Fra m=i / j;
  51. Fra n=a / b;
  52. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘FraInfo’:
prog.c:19:4: error: expected ‘;’ before ‘a’
    a+= i;
    ^
prog.c:41:11: warning: ‘return’ with a value, in function returning void
   }return 1;
           ^
prog.c:10:6: note: declared here
 void FraInfo(int dividend,int divisor,Fra m,Fra n) {
      ^~~~~~~
prog.c:14:6: warning: unused variable ‘b’ [-Wunused-variable]
  int b = 1;
      ^
prog.c: At top level:
prog.c:43:2: error: expected identifier or ‘(’ before ‘if’
  if(j>0){
  ^~
prog.c:48:2: error: expected identifier or ‘(’ before ‘}’ token
  }
  ^
prog.c:50:8: error: ‘i’ undeclared here (not in a function)
  Fra m=i / j;
        ^
prog.c:50:12: error: ‘j’ undeclared here (not in a function)
  Fra m=i / j;
            ^
prog.c:51:11: error: ‘a’ undeclared here (not in a function)
     Fra n=a / b;
           ^
prog.c:51:15: error: ‘b’ undeclared here (not in a function)
     Fra n=a / b;
               ^
prog.c:52:1: error: expected identifier or ‘(’ before ‘}’ token
 }
 ^
stdout
Standard output is empty