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, 22.06.2019 19:30
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
question
Computers and Technology, 25.06.2019 00:30
You are to write a series of steps that anyone could follow to solve the following three problems: 1. even odd a. assume that someone tells you a number (an integer number) b. you hear the number and respond with the word even or odd 2. average a. assume that someone tells you between 3 and 5 numeric values. b. you hear the numbers and respond with the average is some number 3. dog or cat a. explain to a child the differences between a dog and a cat. b. your explanation could be used by a child or anyone to distinguish the difference between a dog and a cat
Answers: 1
question
Computers and Technology, 25.06.2019 13:30
Landslides often accompany earthquakes and volcanoes and pose an additional threat to humans after these events. true false
Answers: 1
question
Computers and Technology, 25.06.2019 19:30
Denise is creating a web page about rainforest animals. her friend has many photos of animals from a trip to brazil. denise wants to use some of those photos for her web page. which input device is best for transferring photos to her multimedia project? a. digitizing tablet b. keyboard c. graphic pad d. digital camera reset next
Answers: 1
You know the right answer?
Find addition of two numbers using Class Template Given template type, two numbers N1 and N2, creat...
Questions
question
Mathematics, 29.09.2020 07:01
question
English, 29.09.2020 07:01
question
Mathematics, 29.09.2020 07:01
question
Social Studies, 29.09.2020 07:01
Questions on the website: 13722367