Question
Please help me to write a program in C++ with comments and to keep it simple as possible. Thank you! Here is my program I
Please help me to write a program in C++ with comments and to keep it simple as possible.
Thank you!
Here is my program I have done before and that need to be change:
#include
#include
using namespace std;
// function prototype returning one value
double cylvol(double, double); // Note: two data types inside brackets
double surfarea(double, double); // Note: two data types inside brackets
int main()
{
double r, l, V, S;
cout
cout
cin >> r >> l;
V = cylvol(r, l); // Note: passing two numbers to function
S = surfarea(r, l);
cout
cout
system("pause");
return 0;
}
double cylvol(double r, double l) // Note: receiving two numbers
{
double V;
V = 3.14*(r*r*l);
return V;
}
double surfarea(double r, double l) // Note: receiving two numbers
{
double S;
S = 2 * 3.14*(r*l);
return S;
}
C++ Functions (20 points) Convert the following programming assignment that you have done before using C++ Class. Create constructors, set and get methods and all other necessary methods. Create your own main 0 program to thoroughly test whether your class design works well. Write a program to calculate a volume and side surface of a cylinder with a given radinus and length respectively. Write a function for each calculation. Display the results in a readable format with two decimal points. Below shows information on how to calculate the volume and the side surface of a cylinder, and how the function should be designed. Volume of cylinder The volume, V, of a cylinder is given by this formula; r is the cylinder's radius, and L is its length Using this formula, write a C++fimction named cyvol() that accepts a cylinder's radius and length and return its vohme. Surface area The side surface area, S, of a cylinder is given by this formula r is the cylinder's radius, and 1 is its length Using this formula, write a C++function named surfarea) that accepts a cylinder's radnus and length and return its side surface areaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started