c#
Console.WriteLine("Please type a random word:\t");
String input = Console.ReadLine();
String[] words = {"apple", "car", "basket", "tv"};
Random random = new Random();
int index = random.Next(words.Length);
String randomWord = words[index];
Console.WriteLine(randomWord);
if (input == randomWord) {
Console.WriteLine("You guessed the word! It was\t" + randomWord);
} else {
Console.WriteLine("Sorry. The word was:\t" + randomWord);
}
c#
Console.WriteLine("Please type a random word:\t");
String input = Console.ReadLine();
String[] words = {"apple", "car", "basket", "tv"};
Random random = new Random();
int index = random.Next(words.Length);
String randomWord = words[index];
Console.WriteLine(randomWord);
if (input == randomWord) {
Console.WriteLine("You guessed the word! It was\t" + randomWord);
} else {
Console.WriteLine("Sorry. The word was:\t" + randomWord);
}