C++ Institute C++ Certified Professional Programmer CPP Question # 29 Topic 3 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 29 Topic 3 Discussion

CPP Exam Topic 3 Question 29 Discussion:
Question #: 29
Topic #: 3

What happens when you attempt to compile and run the following code?

#include

#include

#include <algorithm>

using namespace std;

templatestruct Out {

ostream & out;

Out(ostream & o): out(o){}

void operator() (const T & val ) { out<

int main() {

int t[]={3,2,4,1,5,10,9,7,8,6};

vector v1(t,t+10);

sort(v1.begin(), v1.end(), greater());

cout<

return 0;

}

Program outputs:


A.

3


B.

1


C.

6


D.

10


E.

compilation error


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.