New course! Every coder should learn Generative AI!
Try a free lesson0
Declare a template function, taking three arguments of type T. If the third argument is greater than the first, return the secon
template <class T> ______foo(T a, T b, T c) { ______(c > a) { return b; } _________b + c; } Choices: T, if , return , else, class
7 Answers
+ 1
template <class T>
T foo(T a, T b, T c)
{
if (c > a) {
return b;
}
return b + c;
}
0
T if return. T - type of result
0
T, if , return
0
declare a template function, taking three arguments of type T. if the third argument is greater than the first, return the second argument's value. otherwise, return the sum of the second and third arguments.
ANSWER:-
T
If
Return
0
Declare a template function, taking three arguments of type T. If the third argument is greater than the first, return the second argument value. Otherwise, return the sum of the second and third arguments.
Answer:
T: the type of the function called foo
If: first condition to evaluate third is greater than the first
return: if c is not greater, so , return the sum of values.
0
Declare a template function, taking three arguments of type T. If the third argument is greater than the first, return the second argument's value. Otherwise, return the sum of the second and third arguments.
Answer:
template <class T>
T
foo(T a, T b, T c)
{
if
(c > a) {
return b;
}
return
b + c;
}
- 1
class, if, return.