0

Write a program that defines a template function named add(). This function takes two arguments, add two variables and then return the sum.

In main function, define two variables of type int, two variables of type float and two objects of type ‘String’. Now call the add() function three times for these different data types.

5
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by amrith92
-1

This problem has me baffled: Create a program that tests each member of the Resistor Class to ensure that they work properly. Create a main function and instantiate three Resistors 1, 2, and 3. the program will call the EnterResistance function. [mac x]

0

@Patces:
Please refrain from hijacking threads. If you have a question you can't find a solution to, please start your own thread. Also, we can only help you if, and only if, you have put in some sort of effort in, i.e show us some of the code you've been working on

To the OP:
Think of how you would usually make a function that adds two integers and returns its sum, and then learn about templates, and add the required parameters to it.

Edited by amrith92: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.