-
What is the output of this program?
#include <iostream>
using namespace std;
template <typename T = float, int count = 3>
T Multiply(T num1)
{
for(int kk = 0; kk < count; kk++)
{
num1 = num1 * num1;
}
return num1;
};
int main()
{
float num2 = 1.25;
cout << num2 << " " << Multiply<>(num2) << endl;
}
-
- 1.25
- 5.96046
- 1.25 5.96046
- 5.96046 1.25
- None of these
Correct Option: D
In this program, We specify the type in the template function. We need to compile this program by adding -std=c++0x.