Horse Racing (2)

  1. 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.
  2. The string length may be arbitrary, like "Alice", "Jonathan", "orz".
  3. 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.
  4. For simplicity, let's assume there is no space inside the string, so you can read the string with a simple cin.
  5. 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?
Horse Racing with Arbitrary String