12
2
Produce the shortest program which takes two signed integers as input (through stdin or as arguments) and displays 3 different outputs depending upon whether the first number is (1) greater than, (2) smaller than, or (3) equal to the second number.
The Catch
You cannot use any of the following in your program:
- The standard comparison operators:
<
,>
,<=
,>=
,==
,!=
. - Any library file apart from
conio
,stdio
, oriostream
. - Any non-ASCII or non-printable ASCII character.
The Winner
The program with the shortest number of characters wins.
I suppose using things like
abs
without including the library file (because the compiler knows it anyway) isn't allowed either? – Martin Ender – 2014-09-08T11:10:40.8971@MartinBüttner yes, that would be a correct assumption. :) – grove – 2014-09-08T11:16:38.027
5Why the restriction to C(++)? If it's because you want answers to be portable despite the unportability of C's basic types then you should state that. If it's an arbitrary restriction then you should be aware that arbitrary restrictions to one language are unpopular on this site. – Peter Taylor – 2014-09-08T11:35:16.263
8@PeterTaylor it's part of the challenge. It would be a very different ballgame altogether if the question was language-agnostic. Restricting it to C/C++ changes the strategies used when approaching the problem. I recognize the need for questions to be open to most languages to promote participation by more people, but in this particular problem the restriction to C/C++ and their specific operators and methods is an integral part of the challenge. – grove – 2014-09-08T11:44:15.110
Is the ternary operator allowed? – EvilTeach – 2014-09-08T14:03:41.130
1@EvilTeach yes; if anything is not explicitly forbidden in the question, then it is permitted. – grove – 2014-09-08T14:17:19.613