Answer:
Output
height: 10
radius: 2
Cylinder volume: 125.6
Cone Surface: 76.6037
Cone Volume: 41.8667
Sphere volume: 33.4933
Sphere surface: 50.24
Cylinder volume: 125.6
Step-by-step explanation:
//Declaring variables
#include <iostream>
#include <cmath>
using namespace std;
//Defining Pi value
const double PI=3.14;
//Decliring the functions
//volume function for cone
double volumeCone(double r,double h){
return PI * r * r * (h/3);
}
//volume function for sphere surface
double surfaceSphere(double r){
return 4 * PI * r * r;
}
//volume function for cylinderVol
double cylinderVol(double r,double h){
return PI * r * r * h;
}
//volume function for sphere volume
double sphereVol(double r){
return 4/3.0 * PI * r * r * r;
}
//volume function for cone surface
double surfaceCone(double r,double h){
return PI * r * (r+sqrt(h *h + r * r));
}
int main(){
double r,h;
//print the values of height and radius
cout<<"height: ";
cin>>h;
cout<<"radius: ";
cin>>r;
//print the values of geometric forms
cout<<"Cylinder volume: "<<cylinderVol(r,h)<<endl;
cout<<"Cone Surface: "<<surfaceCone(r,h)<<endl;
cout<<"Cone Volume: "<<volumeCone(r,h)<<endl;
cout<<"Sphere volume: "<<sphereVol(r)<<endl;
cout<<"Sphere surface: "<<surfaceSphere(r)<<endl;
cout<<"Cylinder volume: "<<cylinderVol(r,h)<<endl;
}