Please give the FLOWCHART of the whole program. Thank you very much. #include #include using namespace std; //main function of program int main() { float Radius, Height, sa, Volume, len; int option; //Ask user to select between Cylinder or Cone cout<<"Select 1 for Cone 2 for Cylinder: "; cin>>option; //Ask user to enter the Radius and Height cout << "\nPlease Enter the Radius: "; cin >> Radius; cout << "Please Enter the Height: "; cin >> Height; if (option == 1) { //Option 1 calculate SA of Volume of Cone len = sqrt(Radius * Radius + Height * Height); sa = M_PI * Radius * (Radius + len); Volume = (1.0/3) * M_PI * Radius * Radius * Height; cout << "\nThe Surface Area of a Cone = " << sa; cout << "\nThe Volume of a Cone = " << Volume; } else if(option == 2) { //Option 2 calculate SA of Volume of Cylinder sa = 2 * M_PI * Radius * (Radius + Height); Volume = M_PI * Radius * Radius * Height; cout << "\nThe Surface Area of a Cylinder = " << sa; cout << "\nThe Volume of a Cylinder = " << Volume; } else { cout<<"\nInvalid Option"; return 0; } //Check if 1000 ml of wate can fit it or not if (Volume>1000) { cout<<"\n1000 ml of water can fit"; } else { cout<<"\n1000 ml of water cannot fit"; } return 0; }
Please give the FLOWCHART of the whole program. Thank you very much.
#include<iostream>
#include <cmath>
using namespace std;
//main function of program
int main()
{
float Radius, Height, sa, Volume, len;
int option;
//Ask user to select between Cylinder or Cone
cout<<"Select 1 for Cone 2 for Cylinder: ";
cin>>option;
//Ask user to enter the Radius and Height
cout << "\nPlease Enter the Radius: ";
cin >> Radius;
cout << "Please Enter the Height: ";
cin >> Height;
if (option == 1)
{
//Option 1 calculate SA of Volume of Cone
len = sqrt(Radius * Radius + Height * Height);
sa = M_PI * Radius * (Radius + len);
Volume = (1.0/3) * M_PI * Radius * Radius * Height;
cout << "\nThe Surface Area of a Cone = " << sa;
cout << "\nThe Volume of a Cone = " << Volume;
}
else if(option == 2)
{
//Option 2 calculate SA of Volume of Cylinder
sa = 2 * M_PI * Radius * (Radius + Height);
Volume = M_PI * Radius * Radius * Height;
cout << "\nThe Surface Area of a Cylinder = " << sa;
cout << "\nThe Volume of a Cylinder = " << Volume;
}
else
{
cout<<"\nInvalid Option";
return 0;
}
//Check if 1000 ml of wate can fit it or not
if (Volume>1000)
{
cout<<"\n1000 ml of water can fit";
}
else
{
cout<<"\n1000 ml of water cannot fit";
}
return 0;
}
Step by step
Solved in 2 steps with 1 images