24 game/CSharp: Difference between revisions
Content added Content deleted
(Created page with '=={{header|C_sharp|C#}}== The C# language does not directly contain an Eval function for evaluating a string as a math expression, though there are still a number of ways to go a…') |
mNo edit summary |
||
Line 348: | Line 348: | ||
} |
} |
||
</lang> |
</lang> |
||
Example output: |
|||
<pre> |
|||
--------------------------------- 24 Game --------------------------------- |
|||
------------------------------- Instructions ------------------------------ |
|||
Four digits will be displayed. |
|||
Enter an equation using all of those four digits that evaluates to 24 |
|||
Only * / + - operators and () are allowed |
|||
Digits can only be used once, but in any order you need. |
|||
Digits cannot be combined - i.e.: 12 + 12 when given 1,2,2,1 is not allowed |
|||
Submit a blank line to skip the current puzzle. |
|||
Type 'Q' to quit |
|||
Example: given 2 3 8 2, answer should resemble 8*3-(2-2) |
|||
--------------------------------------------------------------------------- |
|||
1 3 3 4: 4*(3-1)*3 |
|||
Good work. 4*(3-1)*3 = 24. |
|||
1 3 5 6: |
|||
</pre> |