fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double f1(double x)
  5. {
  6. return 1;
  7. }
  8.  
  9. double f2(double x)
  10. {
  11. return x;
  12. }
  13.  
  14. double int1_1_0(double x)//f(x)=1
  15. {
  16. return 0.5;
  17. }
  18.  
  19. double int2_1_0(double x)//f(x)=1
  20. {
  21. return 1.0/3;
  22. }
  23.  
  24. int main(void)
  25. {
  26. double C1 = (2-5*sqrt(6)/18);
  27. double C2 = 5*sqrt(6)/18-1.5;
  28. double x1 = (6-sqrt(6))/10;
  29. double x2 = (6+sqrt(6))/10;
  30. double left = int1_1_0;
  31. double right = C1*f1(x1)+C2*f2(x2);
  32. printf("%lf=%lf\n",left, right);
  33. left = int2_1_0;
  34. right = C1*f2(x1)+C2*f2(x2);
  35. printf("%lf=%lf\n",left, right);
  36. return 0;
  37. }
  38.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:30:16: error: cannot convert ‘double (*)(double)’ to ‘double’ in initialization
  double left = int1_1_0;
                ^~~~~~~~
prog.cpp:33:9: error: cannot convert ‘double(double)’ to ‘double’ in assignment
  left = int2_1_0;
         ^~~~~~~~
stdout
Standard output is empty