fork download
  1. #include <stdio.h>
  2. /*「半径を入力してください」というメッセージだけを画面に表示する関数のプロトタイプ宣言:関数名はmessageとする*/
  3. void message(void);
  4. /*実数値の半径をキーボードから読み込み、その値を戻り値として返す事だけをする関数のプロトタイプ宣言:関数名はhankeiとする*/
  5. double hankei(void);
  6. /*半径を引数として受け取り、円の面積を計算してその結果を戻り値として返す事だけをする関数のプロトタイプ宣言:関数名はmensekiとする*/
  7. double menseki(double r);
  8. /*円の面積を引数として受け取り、その値を「面積は○○です。」とだけ画面に表示する関数のプロトタイプ宣言:関数名はhyoujiとする*/
  9. void hyouji(double s);
  10. /*メイン関数の定義*/
  11. int main(void){
  12. double r;
  13. double s;
  14. message ();
  15. r=hankei ();
  16. s=menseki (r);
  17. hyouji (s);
  18. return(0);
  19. }
  20. /*メイン関数定義終了*/
  21.  
  22. /*関数messageの本体定義*/
  23. void message(void){
  24. puts("半径を入力してください");
  25. return(0);
  26. }
  27.  
  28. /*関数hankeiの本体定義*/
  29. double hankei(void){
  30. double r;
  31. scanf("%lf",&r);
  32. return(r);
  33. }
  34.  
  35. /*関数mensekiの本体定義*/
  36. double menseki(double r){
  37. return(r*r*3.14);
  38. }
  39.  
  40. /*関数hyoujiの本体定義*/
  41. void hyouji(double s){
  42. printf("面積は%lfです\n",s);
  43. return();
  44. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
4
compilation info
prog.c: In function ‘message’:
prog.c:25:7: warning: ‘return’ with a value, in function returning void
 return(0);
       ^
prog.c:23:6: note: declared here
 void message(void){
      ^~~~~~~
prog.c: In function ‘hyouji’:
prog.c:43:8: error: expected expression before ‘)’ token
 return();
        ^
prog.c:43:7: warning: ‘return’ with a value, in function returning void
 return();
       ^
prog.c:41:6: note: declared here
 void hyouji(double s){
      ^~~~~~
prog.c: In function ‘hankei’:
prog.c:31:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
 scanf("%lf",&r);
 ^~~~~~~~~~~~~~~
stdout
Standard output is empty