Consider the following program in which the statements are in
the incorrect order. Rearrange the statements so that the program
prompts the user to input the height and the radius of the base of
a cylinder and outputs the volume and surface area of the cylinder.
Formant the output to two decimal places.
#include <iomanip>
#include <cmath>
int main ()
{}
double height;
cout << ”Volume of the cylinder = “
<<PI * pow(radius, 2.0) * height << endl;
cout << “Enter the height if the cylinder: “;
cin >> radius;
cout << endl;
return 0;
double radius;
cout << “Surface area: “
<< 2 * radius * + 2 * PI * pow (radius, 2.0) <<
endl;
cout << fixed << showpoint << setprecision
(2);
cout << “Enter the radius of the base of the cylinder:
“;
cin >> height;
cout << endl;
#include <iostream>
const double PI = 3.14159;
using namespace std;
The correct order of the code is as follows:
Program screenshot:
Sample output:
Code to copy:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
const double PI = 3.14159;
double height;
double radius;
cout << "Enter the height if the cylinder: ";
cin >> height;
cout << endl;
cout << "Enter the radius of the base of the cylinder:
";
cin >> radius;
cout << endl;
cout << fixed << showpoint << setprecision
(2);
cout << "Volume of the cylinder = "
<<PI * pow(radius, 2.0) * height << endl;
cout << "Surface area: "
<< 2 * radius * + 2 * PI * pow (radius, 2.0) <<
endl;
return 0;
}
Consider the following program in which the statements are in the incorrect order. Rearrange the statements...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ CODE Consider the following program in which the statements are in the incorrect order. Rearrange the statements in the following order so that the program prompts the user to input: The height of the base of a cylinder The radius of the base of a cylinder The program then outputs (in order): The volume of the cylinder. The surface area of the cylinder Format the output to two decimal...
In C++ Amanda and Tyler opened a business that specializes in shipping liquids, such as milk, juice, and water, in cylindrical containers. The shipping charges depend on the amount of the liquid in the container. (For simplicity, you may assume that the container is filled to the top.) They also provide the option to paint the outside of the container for a reasonable amount. Write a program that does the following: Prompts the user to input the dimensions (in feet)...
The value of π can be approximated by using the following series: The program in main.cpp uses this series to find the approximate value of π. However, the statements are in the incorrect order, and there is also a bug in this program. Rearrange the statements and remove the bug so that this program can be used to approximate π. The code that they have: #include <iostream> #include <iomanip> using namespace std; int main() { double pi = 0; long...
c++ Please help! i keep getting an error message. I think my main problem is not understanding the circle calculations function and how both the area and the circumference is returned from the function. I know & needs to be used, but I am unsure how to use it. Copy the following code and run it. You should break it into the following 3 functions getValidinput - which asks the user to enter the radius and then make sure that...
In this exercise, you will modify the hypotenuse program shown earlier in Figure 9-6. Follow the instructions for starting C++ and viewing the ModifyThis13.cpp file, which is contained in either the Cpp8/Chap09/ModifyThis13 Project folder or the Cpp8/Chap09 folder. Remove both calculation tasks from the main function, and assign both to a program-defined value-returning function named getHypotenuse. Test the program appropriately. //Hypotenuse.cpp - displays the length of a right //triangle's hypotenuse #include <iostream> #include <iomanip> #include <cmath> using namespace std; int...
NEED HELP WITH THIS!! Open with Drive N // Test1B-Debug.cpp .This is a program with 6 errors in it Find and fix each error. // Simple Container made from circular paper // Test-1B Debug Program #include #include
C++ code for CIS054 Create a program that uses a function to determine the length of a line by inputting the X,Y coordinates of the line endpoints. Show the result with a precision of four decimal places. The function prototype is to be specified as follows: double LengthOfLine (double X1, double Y1, double X2, double Y2); // returns length of line by using this code: #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main(int argc, char* argv[])...
can someone assist me and tell me what I'm missing. I managed to get it this far but still missing two parts to complete it. CENGAGE MINDTAP Programming Exercise 6-4 Tasks main.cpp + 1 #include <iostream r with successful Uses piand 2 #include <cnath> output 5,00 out of 10.00 3 using nanespace std; 4 5 const double PI = 3.1419; 2 out of 4 checks passed. Review 6 the results below for more details. 7 int main() 8 ( Checks...
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 <iostream> #include <iomanip> 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 << setprecision(2) <<...
How to turn this file into a main.cpp, a header which contains the function declaration, and a implementation fiel containing the function definition ? #include<iostream> #include<string> #include<iomanip> using namespace std; #define NUM 1 #define MULT 4 void getPi(int iter); int main() { int it; cout << "Enter the number of iterations needed to find PI: "; cin >> it; while (it < 1) { cout << "Error!!! Iteration input should be positive." << endl;...