subject

Find addition of two numbers using Class Template Given template type, two numbers N1 and N2, create a class 'ProblemSolution' with following characteristics
The class contains two private members of type template, and a parameterized constructor to initialize the members.
Inside class create a public member function 'add' with no argument, to calculate addition of member variables and return addition of template type.
Input
1
2
6
Where,
The first line contains the data type which can be 1 or 2. i. e. 1 for integer and 2 for float.
The second line contains input N1.
The third line contains input N2.
Output
8
Assume that,
N1 and N2 numbers are within the range [-1000 to 1000].
Not sure where to start, please use template below, C++:
#include
#include
using namespace std;
like cout/cin.
//write your code here
int main()
{
int I1, I2;
float F1, F2;
int dataType;
cin>> dataType;
if(dataType==1){
cin>>I1;
cin>>I2;
ProblemSolution problemSolution(I1, I2);
cout< }else if(dataType==2){
cin>>F1;
cin>>F2;
ProblemSolution problemSolution(F1, F2);
cout< }
return 0;
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
How many pairs of chromosomes do human body cells contain?
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
List 3 items that were on kens resume that should have been excluded
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
You know the right answer?
Find addition of two numbers using Class Template Given template type, two numbers N1 and N2, creat...
Questions
Questions on the website: 13722367