Write a program to play the following game: Begin by displaying the ten digits 0 to 9 in some random order. Repeatedly ask the player to choose a number n, after which the computer will reverse the first n digits in the sequence. The object of the game is for the player to put all the digits in ascending order using as small a number of reversals as possible. Set up your program so that after each game it asks if the game should be repeated with the same starting sequence, played with a new starting sequence, or terminated.
Comments (0)
You don't have permission to comment on this page.