What happens when you attempt to compile and run the following code?#include <iostream>#include <map>#include <vector>#include <sstream>#include <string>using namespace std;int main(){int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };vector<int> v(t, t+10);map<int,string> m;for(vector<int>::iterator i=v.begin(); i!=v.end(); i++) {stringstream s; s<<*i<<*i; m.insert(pair<int,string>(*i,s.str()));}for(map<int, string>::iterator i=m.begin();i!= m.end(); i++) { cout<<*i<<" ";}return 0;}
A. program outputs: 3 4 2 1 6 5 7 9 8 0
B. program outputs: 00 11 22 33 44 55 66 77 88 99
C. program outputs: 0 1 2 3 4 5 6 7 8 9
D. program outputs: 0 00 1 11 2 22 3 33 4 44 5 55 6 66 7 77 8 88 9 99 E. compilation error
What happens when you attempt to compile and run the following code?#include <iostream>#include <map>#include <vector>#i
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What happens when you attempt to compile and run the following code?#include <iostream>#include <map>#include <vector>#i
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!