Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program Develop a template function bigger( ). The function takes two parameters of any data type that can be compared using > operator. The

C++ Program

Develop a template function bigger( ). The function takes two parameters of any data type that can be compared using ">" operator. The function returns the bigger value. (20 points)

Develop a template class box. (40 points)

The box class has a private array data[50] that can hold any data type.

The box class has a private integer variable count, which is used to record how many values are in the box.

There is a method (function) add( ). It can add a value into the array.

There is a constructor. It will make the box an empty box to start with.

There is a bool function empty. It will return true if there is nothing in the box. It will return false otherwise.

Develop a main( ) function: (30 points)

Ask the user to enter two names (such as Bob and Helen). Display the bigger one using the bigger( ) function.

Ask the user to enter two double values (such as 3.14 and 5.24). Display the bigger one using the bigger( ) function.

Create a box object strbox, that can handle strings.

Create a box object intbox, that can handle integers.

Put a string into strbox. (any value you want)

. Display whether the strbox is empty using the empty( ) method.

Display whether the intbox is empty using the empty( ) method.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions