Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!