fork download
  1. #include <stdio.h>
  2.  
  3. double max(double,double);
  4. double abs(double);
  5. double cube(double);
  6. //main関数
  7. int main(void) {
  8. double a, b;
  9. a = -3.2;
  10. b = 1.4;
  11. printf("max(|%lf|,(%lf)^3)=%lf\n",a,b,max(abs(a),cube(b)));
  12. return 0;
  13. }
  14. //二つの引数の大きい方の値を返す関数
  15. double max(double x, double y){
  16. return (x>y)?x:y;
  17. }
  18.  
  19. //引数の絶対値を返す関数
  20. double abs(double x){
  21. return (x>0)?x:-x;
  22. }
  23.  
  24. //引数の三乗の値を返す関数
  25. double cube(double x){
  26. return x*x*x;
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
max(|-3.200000|,(1.400000)^3)=3.200000