MultipleChoice
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <map>
using namespace std;
int main() {
int t[] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
string s[] = { 'one', 'one', 'two', 'two', 'three','three', 'four', 'four', 'five', 'five'};
map<int, string> m;
for (int i = 0; i < 10; i++) {
m.insert(pair<int, string>(t[i], s[i]));
}
if (m.count(3) == 2) {
m.erase(3);
}
for (map<int, string>::iterator i = m.begin(); i != m.end(); i++) {
cout << i?>first << ' ';
}
return 0;
}
OptionsMultipleChoice
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int main() {
int t[] = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5 };
string s[] = { "one", "one", "two", "two", "three","three", "four", "four", "five", "five"};
map
for (int i = 0; i < 10; i++) {
m.push_back(pair
}
for (map
cout << i?>first << " ";
}
return 0;
}
OptionsMultipleChoice
What happens when you attempt to compile and run the following code?
#include
#include
#include
using namespace std;
int main(){
int second[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 10 };
string first[] = {"three", "four", "two", "one", "six","five", "seven", "nine","eight"," ten"};
map
for(int i=0; i<10; i++) {
m.insert(pair
}
if (m[11] == "eleven") {
cout<<"eleven ";
}
for(map
cout<second<<" ";
}
cout< return 0; }