#include <iostream>
using namespace std;
const float PI=3.1415926;
double getvolume(double height,double radius=1.0){
return height*radius*radius*PI;
}
int main(){
double X,Y;
int n;
cout<<"Enter height and radius input 1,or 0:";
cin>>n;
if(n=1){
cout<<"Enter height and radius:";
cin>>X>>Y;
cout<<"The data is:"<<getvolume(X,Y)<<endl;
}
else{
cout<<"Enter only height:";
cin>>X;
cout<<"The data is:"<<getvolume(X)<<endl;
}
return 0;
}
转载请注明原文地址: https://ju.6miu.com/read-36264.html