meu primeiro commit carinhoso
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
namespace ConsoleApp2;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int numerodetentativas = 0;
|
||||
Console.ForegroundColor = ConsoleColor.DarkGreen;
|
||||
Console.WriteLine("Qual o animal secreto?");
|
||||
string tentativa = Console.ReadLine();
|
||||
string animalsecreto = "gato";
|
||||
while (tentativa != "gato")
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||
Console.WriteLine("Errou!");
|
||||
tentativa = Console.ReadLine();
|
||||
numerodetentativas++;
|
||||
}
|
||||
Program.VerificarAnimal(tentativa, animalsecreto, numerodetentativas);
|
||||
}
|
||||
static bool VerificarAnimal(string tentativa, string animalsecreto, int numerodetentativas)
|
||||
{
|
||||
if (tentativa == animalsecreto)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("Acertou!");
|
||||
Console.ForegroundColor = ConsoleColor.DarkBlue;
|
||||
Console.WriteLine($"Voce acertou em {numerodetentativas} tentativas");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user