USE THE ONLY THE TEMPLATE PROVIDED AT THE END OF THE QUESTION IN YOUR SOLUTION . MATCH OUTPUT AND INPUT AS IT IS.     ------------------------------------------------ Write a C++ program to design a program to sum and display two values using templates. Note: Use function templates. 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. In the main method, get the two values to sum and display the value using a function template. Use Template variable T to obtain the arguments of the function sum. Problem Constraints: void sum(T value1,T value2) to sum and display the values Input and Output Format: Refer to sample Input and Output for format specifications. [All text in bold corresponds to input and rest corresponds to output] Sample Input and Output 1: Menu 1.Sum integer values 2.Sum double values 3.Sum char values Enter your choice: 1 Enter the value of x: 10 Enter the value of y: 20 Sum value: 30 Sample Input and Output 2: Menu 1.Sum integer values 2.Sum double values 3.Sum char values Enter your choice: 2 Enter the value of x: 40.25 Enter the value of y: 12.10 Sum value: 52.35 Sample Input and Output 3: Menu 1.Sum integer values 2.Sum double values 3.Sum char values Enter your choice: 3 Enter the value of x: a Enter the value of y: b Sum value: 195   ---------------------TEMPLATE BELOW------------------ #include using namespace std; template void sum(T value1, T value2) { //Fill your code here } //Fill your code here void sum//Fill your code here { //Fill your code here } int main() { int ch; cout<<"Menu"<>ch; if(ch == 1) { //Fill your code here } if(ch == 2) { //Fill your code here } if(ch == 3) { //Fill your code here } return 0; }

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
icon
Related questions
Question
100%
USE THE ONLY THE TEMPLATE PROVIDED AT THE END OF THE QUESTION IN YOUR SOLUTION . MATCH OUTPUT AND INPUT AS IT IS.
 
 
------------------------------------------------

Write a C++ program to design a program to sum and display two values using templates.

Note: Use function templates.

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.

In the main method, get the two values to sum and display the value using a function template.

  • Use Template variable T to obtain the arguments of the function sum.


Problem Constraints:
void sum(T value1,T value2) to sum and display the values

Input and Output Format:
Refer to sample Input and Output for format specifications.
[All text in bold corresponds to input and rest corresponds to output]

Sample Input and Output 1:
Menu
1.Sum integer values
2.Sum double values
3.Sum char values
Enter your choice:
1
Enter the value of x:
10
Enter the value of y:
20
Sum value: 30

Sample Input and Output 2:
Menu
1.Sum integer values
2.Sum double values
3.Sum char values
Enter your choice:
2
Enter the value of x:
40.25
Enter the value of y:
12.10
Sum value: 52.35

Sample Input and Output 3:
Menu
1.Sum integer values
2.Sum double values
3.Sum char values
Enter your choice:
3
Enter the value of x:
a
Enter the value of y:
b
Sum value: 195

 

---------------------TEMPLATE BELOW------------------

#include <iostream>
using namespace std;
template<class T>
void sum(T value1, T value2)
{
//Fill your code here
}
//Fill your code here
void sum//Fill your code here
{
//Fill your code here
}

int main()
{
int ch;
cout<<"Menu"<<endl;
cout<<"1.Sum integer values"<<endl;
cout<<"2.Sum double values"<<endl;
cout<<"3.Sum char values"<<endl;
cout<<"Enter your choice:"<<endl;
cin>>ch;
if(ch == 1) {
//Fill your code here
}
if(ch == 2) {
//Fill your code here
}
if(ch == 3) {
//Fill your code here

}
return 0;
}

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education