Question
1.
#include
2.
using namespace std;
3.
template
4.
void loopIt(T x)
5.
{
6.
int count = 3;
7.
T val[count];
8.
for (int ii=0; ii < count; ii++)
9.
{
10.
val[ii] = x++;
11.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
template
4.
void loopIt(T x)
5.
{
6.
int count = 3;
7.
T val[count];
8.
for (int ii=0; ii < count; ii++)
9.
{
10.
val[ii] = x++;
11.
cout
Answer: Option C
Was this answer helpful ?
Answer:d
Explanation:In this program, We are using the for loop to increment the value by 1 in the function template.
Output:
$ g++ ftemp5.cpp
$ a.out
2.1
3.1
4.1
Was this answer helpful ?
Submit Solution