Vidyalelo
C++ Programming · Q138

C++ miscellaneous

Programming · C++ Programming · question 138

Q138

What will be the output of the following C++ code? #include #include #include #include #include using namespace std; int main () vector numbers; numbers.push_back ( new string ("one") ); numbers.push_back ( new string ("two") ); numbers.push_back ( new string ("three") ); vector lengths ( numbers.size() ); transform (numbers.begin(), numbers.end(), lengths.begin(), mem_fun(&string :: length)); for (int i = 0; i < 3; i++) cout << lengths[i]; return 0;

A.
335
Answer
B.
225
C.
334
D.
224

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board