C++ Institute C++ Certified Professional Programmer CPP Question # 12 Topic 2 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 12 Topic 2 Discussion

CPP Exam Topic 2 Question 12 Discussion:
Question #: 12
Topic #: 2

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

#include

#include <algorithm>

#include

using namespace std;

int main() {

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

map m;

for(int i=0; i < 10; i++) {

m[i]=t[i];

}

pair p(5,5);

map::iterator it = find(m.begin(), m.end(), p);

if (it != m.end())

{

cout<first<

}

else

{

cout<<"Not found!\n";

}

return 0;

}

Program outputs:


A.

5


B.

Not found!


C.

10


D.

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.