#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define CONST 267
void getInput(int *length, int *width, int *height);
void calcoutput(int length, int width, int height, int *squareFootage,int *paintNeeded);
int getSquareFootage(int length,int width, int height);
double getPaintNeeded(int squareFootage);
int main(void)
{
int length;
int width;
int height;
int squareFootage;
double paintNeeded;
getInput(&length, &width, &height);
calcoutput(length, width, height,&squareFootage,&paintNeeded);
return 0;
} //end main
void getInput(int *plength, int *pwidth, int *pheight)
{
printf("Enter the length of the room (whole number only): ");
scanf("%d", plength);
printf("Enter the width of the room (whole number only): ");
scanf("%d", pwidth);
printf("Enter the height of the room (whole number only): ");
scanf("%d", pheight);
} //end getInput
void calcoutput(int length, int width, int height, int *squareFootage,int *paintNeeded){
*squareFootage = getSquareFootage(length,width, height);
*paintNeeded = getPaintNeeded(squareFootage);
}
int getSquareFootage(int length,int width, int height){
int i;
i = 2*(length* height) + 2*(width*height) + (length* width);
return i;
}
double getPaintNeeded(int squareFootage)
{
double i = double (squareFootage / CONST);
return i;
}
私は部屋の面積と部屋をペイントするために必要なペイントのガロン数を計算するためにこのコードを書いています、しかし私はCのポインターにあまり精通していないので、このようないくつかのエラーと警告があるようです
C:\Users\khoavo\Desktop\hw2b.c||In function 'main':|
C:\Users\khoavo\Desktop\hw2b.c|23|warning: passing argument 5 of 'calcoutput' from incompatible pointer type|
C:\Users\khoavo\Desktop\hw2b.c|8|note: expected 'int *' but argument is of type 'double *'|
C:\Users\khoavo\Desktop\hw2b.c||In function 'calcoutput':|
C:\Users\khoavo\Desktop\hw2b.c|41|warning: passing argument 1 of 'getPaintNeeded' makes integer from pointer without a cast|
C:\Users\khoavo\Desktop\hw2b.c|10|note: expected 'int' but argument is of type 'int *'|
C:\Users\khoavo\Desktop\hw2b.c||In function 'getPaintNeeded':|
C:\Users\khoavo\Desktop\hw2b.c|52|error: expected expression before 'double'|
||=== Build finished: 1 errors, 2 warnings ===|
これらのエラーと警告をどのように修正できますか?前もって感謝します。