Correct algorithm, wrong result (cout problem?)

Printable View