In main function, define twovariables of type int, two variables of type float a
ID: 3608561 • Letter: I
Question
In main function, define twovariables of type int, two variables of type float and two objectsof type ‘String’. Now call the add() function threetimes for these different data types.
Note: String isa user-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.
Your output should look likethis:
SampleOutput:
Enter two integer values to beadded
Enter First value: 12
Enter Second value: 25
Enter two float values to beadded
Enter First value: 13.5
Enter Second value: 14.2
Enter two Strings to be added
Enter First value:Yasir
Enter Second value:Malik
Addition of two variables ofdifferent data types
Sum of values of type int = 37
Sum of values of type float =27.7
Explanation / Answer
x.x
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.