Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Writea program that defines a template function named add(). Thisfunction takes

ID: 3608407 • Letter: W

Question

Writea program that defines a template function named add(). Thisfunction takes two arguments, add two variables and then return thesum.

Inmain function, define two variables of type int, two variables oftype float and two objects of type ‘String’. Now callthe add() function three times for these different datatypes.

Note: String is auser-defined data type and for this you have to define a classnamed ‘String’. When template function will be calledto add two objects of type String then it must concatenate twostrings.

  

Youroutput should look like this:

SampleOutput:

Enter twointeger values to be added

EnterFirst value: 12

EnterSecond value: 25

Enter twofloat values to be added

EnterFirst value: 13.5

EnterSecond value: 14.2

Enter twoStrings to be added

EnterFirst value: Virtual

EnterSecond value:University

Additionof two variables of different data types

Sum ofvalues of type int = 37

Sum ofvalues of type float = 27.7

Sum ofvalues of type String = VirtualUniversity

Explanation / Answer

please rate - thanks you can find your answer at this post /computer-science-topic-5-455607-cpi0.aspx