Skip to main content
Guess The Number Game

[Desafio Adivinhe o Número] Escreva um programa que gere um número aleatório entre 1 e 100 e o mantenha apenas na memória, e o usuário terá 5 chances para adivinhar o número e vencer o jogo. Se o palpite do jogador for menor, o programa retorna a mensagem: "Tente um número maior!". Se o palpite do jogador for maior, o programa retorna a mensagem: "Tente um número menor!". Se o jogador acertar o número com 5 chances ou menos, ele vence! Se o jogador gastar os 5 palpites em vão ele perde. Então é "Game Over". Resolva em sua linguagem favorita e poste sua solução nos comentários!

[Guess the Number Game] Write a program thar generates a random number between 1 and 100, and keeps it only in memory, and the user/playerwill have 7 chances to guess the number and win the game. If player's guess is lower than the CPU's number, the program returns a message: "Try a higher number!". If the player's guess is bigger than the CPU's number, the program returns a message: "Try a lower number. If the player matches the CPU's number using 5 chances or less, the player wins! If the player uses his 5 chances and don't match the number, then it's Game Over!
Write the game in your prefered language and post it in the comments.


https://gist.github.com/tictackode/cb86ec1b4338f1b5bf7b6ce426899e7f

https://gist.github.com/tictackode/cb86ec1b4338f1b5bf7b6ce426899e7f


A solution in C language

https://gist.github.com/tictackode/981c1efa457799c3b4aea1ee7736c31b

https://gist.github.com/tictackode/981c1efa457799c3b4aea1ee7736c31b

About the author

  • I'm an Information Systems Bachelor that writes code even by hobby, and now got into a mathematics degree for teaching. Sou formado em Sistemas de Informação, estou cursando Licenciatura em Matemática pela UFF-CEDERJ, e amo programar.

No comments yet. Be the first to comment.

Coding Exercises. Exercicios de Algoritmo/Programação

Part 8 of 9

Nesta série postarei desafios de algoritmo originais e resoluções em diversas linguagens de programação. In this series I will post coding exercises and solutions in many programming languagens.

Up nextCode Challenge: First Pokemon[Desafio Mestre Pokemon Iniciante] Neste desafio estamos imersos no mundo Pokemon, e hoje é o dia em que 100 mestre pokemon iniciantes receberão seu primeiro pokemon do Professor. As chances de recebe

More from this blog