What happens when you attempt to compile and run the following code?
#include
using namespace std;
void g(int a)
{
cout<<a?1< } template void g(A a) { cout<<a+1< } int main() { int a = 1; g(a); return 0; }
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) { out< int main() { int t1[]={3,2,4,1,5}; int t2[]={6,10,8,7,9}; vector transform(t1,t1+5,t2,v1.rbegin(), plus for_each(v1.rbegin(), v1.rend(), Out return 0; } Program outputs:
What will happen when you attempt to compile and run the code below, assuming you enter the following sequence: 1 2 3
#include
using namespace std;
int main ()
{
int a,b,c;
cin>>a>>b>>c;
cout<<a<
return 0;
}
Program will output:
What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: 1 2 3 end
#include
#include
#include
#include
using namespace std;
template
ostream & out;
Out(ostream & o): out(o){}
void operator() (const T & val ) {out< int main () { list for( ; !cin.bad() ; ) { int i; cin>>i; l.push_back(i); } for_each(l.begin(), l.end(), Out return 0; } Program will output: