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; }
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> int main() |
Step by step
Solved in 3 steps with 3 images