-8
 printf("The Volume of the cuboid with a height of%d", height);
 printf("and width of%d\n", width);
 printf("and depth of%d\n", depth);
 printf("Gives you the Volume of %lf\n", vcuboid);

"volumeofcuboid.c:5: エラー: 'height' がここで宣言されていません (関数ではありません) volumeofcuboid.c:5: エラー: 'width' がここで宣言されていません (関数ではありません)関数) "

4

2 に答える 2

1

コードを修正するには、Paul Griffiths の回答を参照してください。うまくいかない場合は、このコードを使用して修正してください。

#include <stdio.h>
#include <stdlib.h>

int get_volume(int h,int w,int d);

int main(void) {
  int height = 0, width = 0, depth = 0, volume;
  printf("Height : ");
  scanf("%d", &height);
  printf("Width : ");
  scanf("%d", &width);
  printf("Depth : ");
  scanf("%d", &depth);

  volume = get_volume(height,width,depth);

  printf("Volume : %d * %d * %d = %d\n", height, width, depth, volume);
  return 0;
}


int get_volume(int h,int w,int d) {
  return h * w * d;
}
于 2013-08-07T20:37:43.943 に答える