Computers and Technology

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;
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, shubbs1038a
Your boss wants you to configure his laptop so that he can access the company network when he is on the road. you suggest a vpn connection to him. he is very concerned about security and asks you how secure vpn is. what do you tell him?
Answers: 1
image
Computers and Technology, 22.06.2019 03:50, TheViperMlg23676
You are working as a security analyst in a company xyz that owns the whole subnet range of 23.0.0.0/8 and 192.168.0.0/8. while monitoring the data, you find a high number of outbound connections. you see that ip's owned by xyz (internal) and private ip's are communicating to a single public ip. therefore, the internal ip's are sending data to the public ip. after further analysis, you find out that this public ip is a blacklisted ip, and the internal communicating devices are compromised. what kind of attack does the above scenario depict?
Answers: 3
image
Computers and Technology, 23.06.2019 07:10, anika420
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
image
Computers and Technology, 24.06.2019 08:10, anthonysutton82
Where are american poets found in the dewey decimal system
Answers: 1
Do you know the correct answer?
Find addition of two numbers using Class Template Given template type, two numbers N1 and N2, creat...

Questions in other subjects:

Konu
Mathematics, 06.10.2020 14:01