Problem Solving with C++ (9th Edition)
Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
Publisher: PEARSON
Question
Book Icon
Chapter 4, Problem 9P
Program Plan Intro

  • Include required header files.
  • Declare the “max()” function for two parameters.
  • Declare the “max()” function for three parameters.
  • Define a “max()” function with two parameters.
    • “if” statement to check “x” is greater than “y”.
      • The condition is true, return “x”.
    • Otherwise, return “y”.
  • Define a “max()” function with three parameters.
    • Call “max()” function with two parameters to return the result and store it in “tmp”.
    • “if” statement to check “tmp” is greater than “z”.
      • The condition is true, return “tmp”.
    • Otherwise, return “z”.
  • Define a “main()” function.
    • Declare the variables “a”, “b” and “c”.
    • Get three numbers from the user and input is assigned to the variables.
    • Call the “max()” function of two parameters and print the largest of first two numbers.
    • Call the “max()” function of three parameters and print the largest of all the numbers.

Blurred answer
Students have asked these similar questions
Write a function findFirstUpper() that takes a string as parameter, finds returns the index of the first uppercase letter in the string. If there is no uppercase letter in the string, then the function will return -1.Example: Function call findFirstUpper("best course is CS104!") will return 15 (index of the 'C').Example: Function call findFirstUpper("good morning!") will return -1.   CODEEE:PYTHON PLEASE
Write a function findFirstUpper() that takes a string as parameter, finds returns the index of the first uppercase letter in the string. If there is no uppercase letter in the string, then the function will return -1.Example: Function call findFirstUpper("best course is CS104!") will return 15 (index of the 'C').Example: Function call findFirstUpper("good morning!") will return -1   CODEE:PYTHON
How we can pass the function pointer as a parameter give example.

Chapter 4 Solutions

Problem Solving with C++ (9th Edition)

Ch. 4.3 - Write a function definition for a function called...Ch. 4.3 - Write a function definition for a function called...Ch. 4.3 - Write a function definition for a function isDigit...Ch. 4.3 - Write a function definition for a function...Ch. 4.4 - What is the purpose of the comment that...Ch. 4.4 - Prob. 16STECh. 4.4 - Prob. 17STECh. 4.4 - Carefully describe the process of program testing.Ch. 4.4 - Prob. 19STECh. 4.5 - If you use a variable in a function definition,...Ch. 4.5 - Suppose a function named Function1 has a variable...Ch. 4.5 - The following function is supposed to take as...Ch. 4.5 - Prob. 23STECh. 4.6 - Prob. 24STECh. 4.6 - Prob. 25STECh. 4.6 - Prob. 26STECh. 4.6 - Suppose you have two function definitions with the...Ch. 4.6 - This question has to do with the Programming...Ch. 4.6 - Prob. 29STECh. 4 - A liter is 0.264179 gallons. Write a program that...Ch. 4 - Modify your program from Practice Program 1 so...Ch. 4 - The price of stocks is sometimes given to the...Ch. 4 - Write a program to gauge the rate of inflation for...Ch. 4 - Enhance your program from the previous Practice...Ch. 4 - Write a function declaration for a function that...Ch. 4 - The gravitational attractive force between two...Ch. 4 - Prob. 8PCh. 4 - Prob. 9PCh. 4 - Write a program that computes the annual after-tax...Ch. 4 - Write a program that asks for the users height,...Ch. 4 - Modify your program from Programming Project 2 so...Ch. 4 - Write a program that outputs the lyrics for the...Ch. 4 - To maintain ones body weight, an adult human needs...Ch. 4 - You have invented a vending machine capable of...Ch. 4 - Your time machine is capable of going forward in...Ch. 4 - Do Programming Project 11 from Chapter 3 except...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning