← Back to archive

Stdle #112 · strings · 2026-09-26

What does this C++ snippet output?

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

#include <iostream>
#include <string>
int main() {
std::string s = "12.5abc";
size_t pos;
double d = std::stod(s, &pos);
std::cout << d << " " << pos << "\n";
}
Strings
4 attempts left

Answer & explanation