5.9 · exercise
Pick the bigger one
Two contenders arrive on input, and the starter reads them into registers. Print the larger one.
A clean pattern: assume one of them is the winner, then compare and replace the assumption only when the other is bigger. That way there is exactly one branch to reason about.
What is checked
- the larger value is printed on its own line
- the program exits cleanly
- a comparison decides it
- the same holds for other inputs you do not see: either one can be bigger, they can be equal, and they can be negative
specification
stdin123 87
stdoutprints the right output
exitexits with the right code
sourceuses
cmphiddenright output and exit code on 4 more inputs you do not see
We run your program on the input above and on the hidden ones, and compare what it does. Nothing is matched against a stored solution.