Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Project
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine("\nHello, write you question");
- string userQuestion = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(GenerateAnswer(userQuestion, rnd));
- if (Console.ReadKey().KeyChar == 'a')
- {
- break;
- }
- }
- }
- static string GenerateAnswer(string question, Random rnd)
- {
- var word = question.Split(" ");
- string answer = "";
- var index = rnd.Next(0, word.Length);
- answer += word[index];
- return "Yes is " + answer;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment