Program prompts the user to input the height and the radius

Assignment Help C/C++ Programming
Reference no: EM13339800

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. Format 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 of 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;

Reference no: EM13339800

Questions Cloud

Industry price and output will approach the outcome for : Assume the firms in an oligopoly produce a differentiated product and are initially colluding. If each firm begins to cheat (to increase sales) by underpricing the other firms, as the amount of cheating increases, the resulting industry price and out..
Write a value-returning function : Write a program that uses the function isNumPalindrome given(Palindrome Number). Test your program on the following numbers: 10, 34, 22, 333, 678, 67876, 44444, and 123454321.
How much work is done by the engine in each cycle : An engine absorbs 1.74 kJ from a hot reservoir at 277°C and expels 1.21 kJ to a cold reservoir at 27°C in each cycle. How much work is done by the engine in each cycle
Find the work done by the aluminum : A 7.1-kg block of aluminum is heated from 30°C to 60°C at atmospheric pressure. Find the work done by the aluminum
Program prompts the user to input the height and the radius : 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. Format the output to two decimal places.
Calculate the charge density of the air-assumed constant : At an altitude of 260 m above the Earth's surface, the field is only 105 N/C. Calculate the charge density of the air (assumed constant).
Law of supply and the determinants of supply : How can I explain explain the market equilibrating process in relation to the following: Law of demand and the determinants of demand
Evaluate swobodavilles financial condition : Evaluate Swobodaville's financial condition based on the partial list of factors given. That is, consider any observable trends in the data and what they could potentially mean. To compare the data, in some cases it is best to convert dollar figur..
What is the magnitude of the flux through the rectangle : In a uniform electric field of magnitude E, the field lines cross through a rectangle of area A at an angle of 79.0° with respect to the plane of the rectangle. What is the magnitude of the flux through the rectangle

Reviews

Write a Review

C/C++ Programming Questions & Answers

  C program to solve the quadratic equation of rocket launch

Write a C program to solve the quadratic equation of rocket launch by computing the roots (t1 and t2) of that quadratic equation: gt2 + vt + l = 0 (or) for simplicity ax2 + bx + c = 0. Get the values of g, v, and l from the user. The program should d..

  Write recursive boolean method to accept array and value

Write down the recursive boolean method named isMember. The method must accept two arguments: an array and a value. Method must return true if value is found in array.

  Prepare a businesspartner

Prepare a BusinessPartner class that contains a company name, first name and a telephone number.

  It should be clear, based on your comments

Add comments to the code. It should be clear, based on your comments, what each line (or set of lines) does in the program.

  Write a function that returns the day of the year

Write a function day_of_year(month, day, year) that returns the day of the year (an integer between 1 and 366) specified by the three augments.

  Create class having constructor to recieve two ints

Create a class (in C++)named Card. The class should have two int data members named face and suit.The class should have a constructor that recieves the two ints and uses them to initialize the data members.

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  Write a program using one while loop

Write a program using one while loop that will read in a sequence of integers guaranteed to be within the inclusive range of 0 through 99,999 from the user

  Program to compute and show miles per gallon

Create the program in C++ which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and show miles per gallon.

  Write a c++ program to sort a list of number using vectors

Write a C++ program to sort a list of number using vectors. Output the values when the elements are inserted into its correct position. Assume the first element in the list is sorted.

  Write program to read from file to find number of integers

Write down the program which reads from file numbers.txt 30 integers in range 0 - 200. Program ‎then determines number of integers in each of given ranges.

  Your city''s parking violation

Your city's Parking Violation Bureau wants you to write a program to compute fines for parking violations.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd