C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Videos

Question
Book Icon
Chapter 6.2, Problem 6E

(a)

Program Plan Intro

To definethe function surfarea(double r, double l) that returns the side surface area of cylinder by using the below formula: -

  S=2Πrlristheradiusandlisthelengthofcylinder

(b)

Program Plan Intro

Program plan:

  • Import the header file and use the namespacestd.
  • Declare the function surfarea(double r, double l).
  • Define the main function.
  • Declare the variables to store the radius and length.
  • Prompt the user to enter the radius and length of the cylinder.
  • Call the function surfarea() and displaying the value returned by it.
  • Define the function surfarea() that takes radius and length of the cylinder as the function arguments and returns the side surface area of the cylinder.
  • Declare the variable to store the side surface area of cylinder.
  • Calculate the side surface area.
  • Return the side surface area.

Program description:

The main purpose of the program is to implement the function written in Exercise 6a into the main function and test the function to get the appropriate output.

Blurred answer
Students have asked these similar questions
(C PROGRAMMING ONLY) 2. Weird Treasure Chestby CodeChum Admin I'm now in the middle of the jungle when I saw this weird treasure chest.   It seems that if I properly place the address of a certain number, I get a very weird result!   Instructions: In the code editor, you are provided with a treasureChestMagic() function which has the following description:Return type - voidName - treasureChestMagicParameters - an address of an integerDescription - updates the value of a certain integer randomlyYou do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked.Finally, print the updated value of the integer inputted by the user.Input 1. An integer Output Enter n: 10Treasure Chest Magic Result = 13
(Apartment problem) A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program in C++ that prompts the user to enter: The total number of units. The rent to occupy all the units. Amount to maintain a rented unit. The increase in rent that results in a vacant unit. The program then outputs: The number of units to be rented to maximize the profit The maximum profit Since your program handles currency, make sure to use a data type that can store decimals with a decimal precision of 2.
(C++) Question: Write a function string middle(string str)that returns a string containing the middle character in str if the length of str is odd, or the two middle characters if the length is even. For example, middle("middle") returns "dd".   I'm not getting the correct output. What am I doing incorrectly?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License