#include
# define PI 3.14
Void area (int r, int h)
Void volume (int r, int h)
Int main ()
{int r, h;
The scanf (" % d, % d ", & amp; R, & amp; H);
Area (r, h);
Volume (r, h);
Printf (" % d, % d ", area (r, h), volume (r, h));
}
Void area (int r, int h)
{int s;
S=2 * PI * r * (r + h);
Return s;
}
Void volume (int r, int h)
{int v.
V=r ^ 2 * PI * h;
Return v.
}
CodePudding user response:
Lack of a semicolon at the end of two lines of the prototypeCodePudding user response:
Void model function cannot return a valueCodePudding user response:
Then you also have to consider "physical meaning"The double double
Lf the % % of lf
CodePudding user response:
I come to the point, for reference:# include & lt; Stdio. H>
# define PI 3.14
Float area (int r, int h);//void area (int r, int h); Two functions is the return value, can't type to void
Float volume (int r, int h);//void volume (int r, int h); The return type is accurate, get the real data
Int main (int arg c, char * argv [])
{
Int r, h;
The scanf (" % d % d ", & amp; R, & amp; H);//the scanf (" % d, % d ", & amp; R, & amp; H); Convenient input format or use Spaces, 'and' number easily mistaken
//area (r, h);//function in a place called ok
//volume (r, h);
Printf (" % f, % f \ n ", area (r, h), volume (r, h));//printf (" % d, % d ", area (r, h), volume (r, h));
return 0;
}
Float area (int r, int h)//void area (int r, int h)
{
Float s;//int s;
S=2 * PI * r * (r + h);
Return s;
}
Float volume (int r, int h)//void volume (int r, int h)
{
Float v.//int v;
V=PI * r * r * h;//v=r ^ 2 * PI * h;
Return v.
}
CodePudding user response:
The