(Assignment 4) Template Functions and Classes solved

$30.00

Category: Tags: , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (6 votes)

This assignment statement is taken directly from Problem 4.2 and 4.4 in the Exercise Book for the course (M. D. Adams, Exercises for Programming in C++ (Version 2021-04-01), University of Victoria, Victoria, BC, Canada, Apr. 2021, xxii + 136 pages. ISBN 978-0-9879197-5-5 (ebook).)

4.2 Develop a template function min3 that takes three arguments of the same type and returns the least of these
arguments. For example, min3(1, 0, 2) would return 0 and min3(1.5, 0.5, 3.0) would return 0.5.

4.4 Convert the RealPoint2 class from Exercise 3.6 to a class template Point2. The template should take as a
parameter the type to be used for point coordinates (which might be double, float, int, or some other
numeric type). Test your code for at least one integral type (e.g., short, int, long) and one real type (e.g.,
float, double).