Question: what is the output, please explain the code. 1.) template void fun(const T&x) { static int count = 0; cout < < x =
what is the output, please explain the code.
1.)
template
void fun(const T&x)
{
static int count = 0;
cout << "x = " << x << count << endl;
++ count;
return;
}
int main()
{
fun
cout << endl;
fun
cout < fun cout << endl << endl << endl; return 0; } 2.) What is the ouput? template class Test { private: T val; public: static int count; Test() { count++;} }; template int Test int main() { Test Test Test cout<< Test cout<< Test return 0; } 3.) What is the ouput? void f (int n ) { for (int i = 1 ; i < n ; i++ ) cout << n * i << " " ; cout << " "; if (n > 1) f(n-1); cout<< n << " " ; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
