Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

complete the following using c++. what has to be added to my code, is it correct ? 2. Develop a template function bigger(). The function

complete the following using c++. what has to be added to my code, is it correct ? image text in transcribed
image text in transcribed
image text in transcribed
2. 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) 3. Develop a template class box. (40 points) 3a. The box class has a private array data[50] that can hold any data type. 3b. The box class has a private integer variable count, which is used to record how many values are in the box. 3c. There is a method (function) add(). It can add a value into the array. 3d. There is a constructor. It will make the box an empty box to start with. 3e. There is a bool function empty. It will return true if there is nothing in the box. It will return false otherwise. 4. Develop a main() function: (30 points) 4a. Ask the user to enter two names (such as Bob and Helen). Display the bigger one using the bigger() function. 4b. Ask the user to enter two double values (such as 3.14 and 5.24). Display the bigger one using the bigger() function. 4c. Create a box object strbox, that can handle strings. 4d. Create a box object intbox, that can handle integers. 4e. Put a string into strbox. (any value you want) 4f. Display whether the strbox is empty using the empty() method. 4g. Display whether the intbox is empty using the empty() method. 1 #include 2 using namespace std; 3 template 5 L bigger(L n1, L n2) { 7 return (n1 > n2) ? n1: n2; 8 } 9 10 int main() { 11 int p1, p2; 12 float q1, 42; 13 char ri, r2; 14 char a; 15 cout > pl >> p2; cout > q1 >> 92; 20 cout > r1 >> r2; 22 a = bigger(ri, r2); 23 cout

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

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Describe and discuss system testing.

Answered: 1 week ago

Question

8. Describe the steps in the development planning process.

Answered: 1 week ago