← Back to archive

Stdle #104 · classes · 2026-09-18

What does this C++ snippet output?

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

#include <iostream>
#include <vector>
int main() {
std::vector<int> v = {1, 2, 3};
for (auto x : v) x *= 10;
for (auto x : v) std::cout << x << " ";
std::cout << "\n";
return 0;
}
Classes
4 attempts left

Answer & explanation