Created
March 20, 2021 10:15
-
-
Save megabites2013/924e109ee134cc2fff2da57d442258d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class MainClass | |
{ | |
static void Main (string[] args) | |
{ | |
string secretWord = "Nicholas"; | |
string guess = ""; | |
int guesscount = 0; | |
while(guess != secretWord){ | |
Console.WriteLine("enter guess: "); | |
guess = Console.ReadLine(); | |
guesscount++; | |
Console.WriteLine(guesscount); | |
if(guesscount >= 5){ | |
Console.WriteLine("you failed, the answer was: " + secretWord); | |
break; | |
} else if(guess == secretWord){ | |
Console.WriteLine("You win!"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment