Write a C++ program to find the maximum of two values using a function template. Include a method T maximumNumber(T a, T b) to return the maximum of two given numbers using the template. In the main method, obtain the data type of numbers and get the numbers from the user. Pass the numbers to the maximumNumber () method to find the maximum number
Write a C++ program to find the maximum of two values using a function template. Include a method T maximumNumber(T a, T b) to return the maximum of two given numbers using the template. In the main method, obtain the data type of numbers and get the numbers from the user. Pass the numbers to the maximumNumber () method to find the maximum number
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
QUESTION OUTPUT AND YOUR OUTPUT MUST MATCH
---------------------------------
There is a recreational activity going on in Ashu's colony on Children's Day. It is a race where participants are supposed to collect water in a bowl from one end and pour it into a vessel in another. The race time is fixed, the one who fills more water in the vessel wins the race. You are Ashu and you were asked to design a program to find the winner. Since water quantity could be in decimals as well you decide to use a function template to store the values and find the maximum amongst the two.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.
Write a C++ program to find the maximum of two values using a function template.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.
Write a C++ program to find the maximum of two values using a function template.
Include a method T maximumNumber(T a, T b) to return the maximum of two given numbers using the template.
In the main method, obtain the data type of numbers and get the numbers from the user. Pass the numbers to the maximumNumber () method to find the maximum number.
Input and Output Format:
Refer sample input and output for formatting specifications.
[All text in bold corresponds to input and rest corresponds to output]
Sample Input and Output 1:
1.Integer
2.Double
Enter your choice
1
Enter the first integer value
11
Enter the second integer value
22
The maximum number is 22
Sample Input and Output 2:
1.Integer
2.Double
Enter your choice
2
Enter the first double value
22.15
Enter the second double value
3.14
The maximum number is 22.15
Sample Input and Output 3:
1.Integer
2.Double
Enter your choice
3
Invalid choice
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education