Advertisement
Guest User

Helyes/helytelen

a guest
Jul 26th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1.             string correct;
  2.             string file = "szotar.txt";
  3.             int hossz;
  4.  
  5.             StreamReader sr = new StreamReader(file);
  6.  
  7.             Console.Write("Egy helyes szót kérek: ");
  8.             string word = Console.ReadLine();
  9.             correct = sr.ReadLine();
  10.  
  11.             while (correct != null)
  12.             {
  13.                 if (correct == word)
  14.                 {
  15.                     Console.WriteLine("A szó helyes!");
  16.                     break;
  17.                 }
  18.                 else
  19.                 {
  20.                     correct = sr.ReadLine();
  21.                 }
  22.             }
  23.             if (correct == null)
  24.             {
  25.                 Console.WriteLine("A szó helytelen!");
  26.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement