C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 6.2, Problem 1E
Program Plan Intro

Program plan:

  • Include the header file and use the namespace std for standard I/O.
  • Declare the function findMax(double, double).
  • Define the main function.
  • Declare the variables to store the two double-precision value.
  • Prompt the user to enter the values and storing them.
  • Call the findMax() and storing the value returned by it.
  • Display the maximum number among the two numbers.

Program description:

The main purpose of the program is to modify the program written in exercise 6.5 so that the function findMax() returns the double-precision value to the main function. After the modification the findMax() function takes two double-precision values as the function argument and returns the largest among them.

Blurred answer
Students have asked these similar questions
(Hypotenuse) Define a function hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. Use this function in a program to determine the length of the hypotenuse for each of the triangles shown below. The function should take two double arguments and return the hypotenuse as a double. Sample output Enter 2 sides of right triangle: 3.0 4.0 Hypotenuse: 5.0 Enter 2 sides of right triangle: 5.0 12.0 Hypotenuse: 13.0 Enter 2 sides of right triangle: 8.0 15.0 Hypotenuse: 17.0
(Use Python)Use the Design Recipe to write a function count_vowels, which consumes a string and returns the number of vowels in that string. For these purposes, the vowels are a, e, i, o, and u, but never y. Include a Docstring! Note: Count both upper and lowercase vowels! Write 3 assert_equal statements to test your function.
(use Python) Use the Design Recipe to define a function sum_squares  that consumes two int parameters start and finish.  Use a while loop to sum the squares of all integers from start to finish (inclusive) and returns this sum.   Write 3 assert_equal statements to test your function.
Knowledge Booster
Background pattern image
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