C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 1, Problem 17SA
Explanation of Solution
Algorithm step | C++ instruction (code) |
Get the radius | cin >> radius ; |
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
The volume of a sphere is (4.0/3.0)πr 3 and the surface area is 4.0πr 2, where r is the radius of the sphere. Given the radius, design an algorithm that computes the volume and surface area of the sphere. Also using the C++ statements provided for Example 1-1, write the C++ statement corresponding to each statement in the algorithm. (You may assume that π = 3.141592.)
The volume, V, of a box is given by the formula V where L is the box’s length, W is the box’s width and H is the box’s height. Use this information to write a complete C++ program that asks the user to enter 10 values of box’s length, box’s width and box’s higth measurements, one at a time, and then the program calculates for each value entered the Volume of a box Using a for loop.
The volume, V, of a box is given by the formula V where L is the box’s length, W is the box’s
width and H is the box’s height. Use this information to write a complete C++ program that asks
the user to enter 10 values of box’s length, box’s width and box’s higth measurements, one at a
time, and then the program calculates for each value entered the Volume of a box Using a for
loop.
Chapter 1 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 1 - 1. Mark the following statements as true or...Ch. 1 - Prob. 2SACh. 1 - Prob. 3SACh. 1 - Prob. 4SACh. 1 - Prob. 5SACh. 1 - Prob. 6SACh. 1 - In a C++ program, preprocessor directives begin...Ch. 1 - Prob. 8SACh. 1 - Prob. 9SACh. 1 - Prob. 10SA
Ch. 1 - Prob. 11SACh. 1 - Prob. 12SACh. 1 - Design an algorithm to find the weighted average...Ch. 1 - Prob. 14SACh. 1 - Prob. 15SACh. 1 - 16. The dealer’s cost of a car is 85% of the...Ch. 1 - Prob. 17SACh. 1 - 18. Tom and Jerry opened a new lawn service. They...Ch. 1 - 19. Jason typically uses the Internet to buy...Ch. 1 - Prob. 20SACh. 1 - Prob. 21SACh. 1 - A student spends a majority of his weekend playing...Ch. 1 - You are given a list of students names and their...
Knowledge Booster
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
- (Data processing) Years that are evenly divisible by 400 or are evenly divisible by 4 but not by 100 are leap years. For example, because 1600 is evenly divisible by 400, 1600 was a leap year. Similarly, because 1988 is evenly divisible by 4 but not by 100, it was also a leap year. Using this information, write a C++ program that accepts the year as user input, determines whether the year is a leap year, and displays a message telling the user whether the entered year is or is not a leap year.arrow_forward(Acoustics) The loudness of a sound is measured in units of decibels and is calculated as shown: 10LOG(SL/RL) SL is the intensity of the sound being measured. RL is a reference sound-intensity level. Using this formula, write a C++ program that calculates and displays the decibel loudness of a busy street having a sound intensity of 10,000,000 RL. Verify your program’s result by doing a hand calculation. After verifying that your program is working correctly, use it to determine the sound level in decibels of the following sounds: a.Awhisperatsoundintensity200RLb.Arockbandplayingatsoundintensity1,000,000,000,000RLc.Anairplanetakingoffatsoundintensity100,000,000,000,000RLarrow_forwardThe language is C++ 3. Write a program to calculate the factorial value of the inputnumber.Use the incrementation formula for your solution instead ofdecrementation formula. Apply the three looping statements foryour solution.Enter a No : 4Factorial value : 24arrow_forward
- A triangular number or triangle number counts the objects that can form an equilateral triangle. The nth triangle number is the number of dots or balls in a triangle with n dots on a side; it is the sum of the n natural numbers from 1 to n.Mathematically, the nth triangular number Tn is defined as: Tn=n(n+1)/2Write a C++ program that: reads a positive integer k from the user. If the user enters a negative value, then the program should continue prompting until he/she enters a positive integer value. Then, the program should compute a series of first k triangular number and displaythem as illustrated in the sample output. Also the program will count how many ODD and EVEN triangular numbers in the series(respectively) and display it as illustrated in the sample output. Finally, the program will compute and sum up the members of the series and display the result as illustrated in the sample output.The program must use at least two functions as following:1. A function to compute the…arrow_forwardNote:solution using c++ language Pre-Lab 02: Write a C++ program to calculate a GPA for the user. The program should enter letter grades until any letter other than A, B, C, D, or F is entered. The average should be calculated and printed according to the following: A (or a) = 4.0 B (or b) = 3.0 C (or c) = 2.0 D (or d) = 1.0 F (or f) = 0.0 Use a do..while loop.arrow_forwardwrite c++arrow_forward
- USING SWITCH CASE make a c++ program that generates a plate number based on the user’s answer to the following questions: 1. What is your favorite color of the rainbow (ROYGVIB)? a. Use the first letter of the chosen color as the first character of the plate number. b. Display “Invalid Input” and ask the user to re-enter his/her answer if the answer is not a valid color of the rainbow. 2. What is your month of birth? a. Use the last letter of the month as the second character of the plate number. b. Display “Invalid Input” and ask the user to re-enter his/her answer if the answer is not a valid month. 3. What is your first name? a. Use the third letter of the first name as the third character of the plate number. No need to include the second name if you have a second name. Make sure to use “cout” and “cin” to collect the necessary inputs from the user. For the number section: 1. Ask the user his/her age and use the age as the first and second digits of the plate number. a. Display…arrow_forwardUse C++ Codingarrow_forwardProgram statement: You are required to write both an algorithm and a C++ program that implements a password validation. Your program mainly should contain two stages; the first one is the creation of a new password, while creating the new password your program should checks strength of the password using the following rules: 1. Password length should be 6 characters. 2. Password should not contain any space. 3. Password should contain at least one digit (0-9). 4. Password should contain at least one lowercase letter (a-z). 5. Password should contain at least one uppercase letter (A-Z). 6. Password should contain at least one of the special character (#, %, &,!, $). After applying the above rules and the password is correctly inserted, your program should prompt the user to confirm the password by retyping it again, otherwise the default password that initially defined should be considered. The second stage of the program is the user login to check authorization,…arrow_forward
- Program statement: You are required to write both an algorithm and a C++ program that implements a password validation. Your program mainly should contain two stages; the first one is the creation of a new password, while creating the new password your program should checks strength of the password using the following rules: 1. Password length should be 6 characters. 2. Password should not contain any space. 3. Password should contain at least one digit (0-9). 4. Password should contain at least one lowercase letter (a-z). 5. Password should contain at least one uppercase letter (A-Z). 6. Password should contain at least one of the special character (#, %, &,!, $). After applying the above rules and the password is correctly inserted, your program should prompt the user to confirm the password by retyping it again, otherwise the default password that initially defined should be considered. The second stage of the program is the user login to check authorization,…arrow_forwardاسامه کلاس All Media 27/12/2021, 10:11 AM Q1: Write a C++ program to calculate the volume of a pyramid. Users are required to enter the dimensions of the pyramid, including its height, width, and length. If you enter negative values for length, width, and height, you will receive a display message indicating incorrect input. Afterward, after verifying the validity of these variables, the pyramid's volume is calculated and displayed. Recall that .arrow_forwardUsing c++arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr