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.

You posted this why? Just look-up "c++ templates"
Was that hard?

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]

@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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.