ExamVeda
Login
Home
C plus plus miscellaneous
?

What will be the output of the following C++ code?
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main () 
{
    vector <string*> numbers;
    numbers.push_back ( new string ("one") );
    numbers.push_back ( new string ("two") );
    numbers.push_back ( new string ("three") );
    vector <int> 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;
}

Answer & Solution
Correct Answer: Option A
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.