A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-72.cpp
1#include<iostream>
2structCents{
3intv;
4Cents(intn):v(n){}
5};
6voidshow(Centsc){std::cout<<c.v<<"\n";}
7intmain(){
8show(42);
9return0;
10}
Conversions
Answer & explanation
Console output
42
Why
A constructor that can be called with a single argument and is not marked explicit acts as an implicit conversion. Passing 42 where a Cents is expected silently builds Cents(42), so c.v is 42. This implicit constructor conversion is the core convenience (and footgun) of single-argument constructors.