精选问答
请编写一个程序实现以下的题目要求:1、输入圆柱体的半径(radius)和高(high); 2、定义PI为3.14159; 3、求出圆柱体的体积.Input输入两个数字,第一个数字是圆柱体的半径,第二个是圆柱体的高.Output输出有三行:第一行是圆柱体的半径,第二行是圆柱体的高,第三行圆柱体的体积.每一个输出的结果保留到小数点后3位.具体的请见Sample Output.Sample Input3.8 53 4Sample Outputradius:3.800high:5.000The volume is

2019-04-13

请编写一个程序实现以下的题目要求:
1、输入圆柱体的半径(radius)和高(high); 2、定义PI为3.14159; 3、求出圆柱体的体积.
Input
输入两个数字,第一个数字是圆柱体的半径,第二个是圆柱体的高.
Output
输出有三行:第一行是圆柱体的半径,第二行是圆柱体的高,第三行圆柱体的体积.每一个输出的结果保留到小数点后3位.具体的请见Sample Output.
Sample Input
3.8 53 4
Sample Output
radius:3.800
high:5.000
The volume is:226.823
radius:3.000
high:4.000The volume is:113.097
优质解答
#include "stdafx.h"
#include "iostream"
#define PI 3.14159 ;
using namespace std;
double run(double radius,double high)
{double area;
area = high * radius * radius *PI;
return area;
}
int _tmain(int argc,_TCHAR* argv[])
{
double r,h;
cout >h;
cout
#include "stdafx.h"
#include "iostream"
#define PI 3.14159 ;
using namespace std;
double run(double radius,double high)
{double area;
area = high * radius * radius *PI;
return area;
}
int _tmain(int argc,_TCHAR* argv[])
{
double r,h;
cout >h;
cout
相关问答