Horse Racing (2)
-
Extend your
Horse Racing program
so that when the program starts, it prompts the user to input a string.
The string will be shown as the 9 objects which are racing.
- The string length may be arbitrary, like "Alice", "Jonathan",
"orz".
- Therefore, in contrast to using a "magic number" to determine
whether a horse has arrived at the finishing line, you should smartly
design a formula that can automatically calculate according to the
string length.
- For simplicity, let's assume there is no space inside the string,
so you can read the string with a simple cin.
- Question: If the user input contains a backslash character ('\'), does your
program need to insert an escape sequence so that it can be displayed correctly?