Question PRG-CPP-0043
MediumWhat is the output of this program?
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
map<string, int> m;
m["banana"] = 2;
m["apple"] = 5;
m["cherry"] = 1;
for (auto &p : m) cout << p.first[0];
cout << m.size();
return 0;
}
- A.
abc3
- B.
bac3
- C.
Sign up free to see the answer and a step-by-step explanation.