Question about parameters

I don't know if my English isn't good enough but I just don't get what this task is asking me to do:

Create the C++ Function named multiples so that it has three parameters sum, x, and n. The first two parameters will have the type represented by the function template type parameter. n will always be int. The return type is void. All parameters are passed by value. A Function created from multiples will compute.sum = 1 + x + 2x + 3x + ... + nx and display the result on screen.

I don't really understand this, if anyone understands and could please specify what this means I would appreciate it!

Cheers :)

P.s.: I'm not asking for the code, just want to understand.
Last edited on
I think it is saying:

Create a function called "multiples" that has three parameters: sum, x, and n. This function is a template function with one parameter (call it T). sum and x are of type T (i.e. the template parameter type), and n is of type int. The function's return type is void, and all parameters are passed by value. This function will compute the sum of the equation = 1 + x + 2x + 3x + ... + nx and display the result on screen.


"A Function created from multiples will compute.sum = 1 + x + 2x + 3x + ... + nx" since that doesn't make any sense to me but I put my best guess of what they meant there.
Last edited on
Yeah that's a bit clearer, but I still don't understand 100%.

I don't know where to start from since this doesn't ask an input from the user or anything, and we are meant d to implement all our functions in separate customized library.
Last edited on
Topic archived. No new replies allowed.