0

I need help to understand what I'm supposed to do in this question
I'm not asking for a code what I need is explanation
thanks a lot

write a function template that
returns the range of values stored in a vector <T>that is the
difference between the
largest value and the smallest value
where operator is assumed to be degind for type T

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Duoas
0

It seems fairly well explained as it is.
What more do you need?

A for loop to iterate over the members of the vector perhaps?

0

Actually it is quite vague.

To my mind, the most probable meaning is that you are to write a function that takes a vector as argument, finds both the largest and smallest values in the vector, and returns (largest minus smallest).

Read another way, you might have to write a function that takes two values and returns a vector iterating from the smallest to the largest.

Either way, the type T must have collative properties (having at least operator< defined) and additive properties (having operator+ and/or operator- defined). A good type T would be int, for example.

I would go and ask your professor for clarification.

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.