← Back to archive

Stdle #62 · containers · 2026-08-07

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
#include <map>
int main() {
std::map<std::string,int> m;
std::cout << m.count("x") << " ";
m["x"];
std::cout << m.count("x") << "\n";
}
Containers
4 attempts left

Answer & explanation