Advertisement
Nickzouk

hangman aplo

Jan 7th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1.  
  2. using System;
  3.  
  4. namespace itscoldoutside
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.WriteLine("poses leksis thes ?");
  11.             int n = int.Parse(Console.ReadLine());
  12.  
  13.             string[] array = new string[n];
  14.  
  15.             Console.WriteLine("dose {0} lekseis", n);
  16.  
  17.             for (int i = 0; i < n; i++)
  18.             {
  19.                 array[i] = Console.ReadLine();
  20.             }
  21.             Random rnd = new Random();
  22.                 int num = rnd.Next(0, n);
  23.  
  24.             string word = array[num];
  25.             char[] guess = new char[word.Length];
  26.  
  27.             int lives = 6;
  28.             Console.WriteLine("bale grama");
  29.             for (int i = 0; i < guess.Length; i++)
  30.             {
  31.                 guess[i] = '*';
  32.             }
  33.  
  34.             while (true)
  35.             {
  36.                 char inputWord = char.Parse(Console.ReadLine());
  37.                  for (int j = 0; j < word[j]; j++)
  38.                  {
  39.                     if (inputWord == word[j])
  40.                     {
  41.                         guess[j] = inputWord;
  42.                     }
  43.                  }
  44.                
  45.                 Console.WriteLine(guess);
  46.             }
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement