Indovina il numero!

2012-03: Easy 1
Write a number guessing game.
The program selects a random number between 1 and 100 and asks the player to guess it.
The program then checks the input and states if it is too high, too low or correct.
If it is correct then the player is told how many guesses they took and asked if they want to play again, if it is incorrect they get another guess.

Scrivi un gioco del tipo  “Indovina il numero”.
Il programma sceglie un numero casuale tra 1 e 100 e chiede al giocatore di indovinarlo.
Il programma poi controlla la risposta e decide se è troppo alta, troppo bassa oppure corretta.
Se è corretta allora comunica al giocatore quanti tentativi ha fatto e gli chiede se vuole giocare di nuovo, se è scorretta gli offre un nuovo tentativo.

Soluzione

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *