Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace teszt
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] honapok = new string[12] { "január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december" };
- byte[] napok = new byte[12] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- byte valasz, idx_honap;
- int hibas = 0;
- int jo = 0;
- for (int szamolo = 0; szamolo <= 2; szamolo++)
- {
- Random rnd = new Random();
- idx_honap = Convert.ToByte(rnd.Next(0, 11));
- Console.Write("Hány napos " + honapok[idx_honap] + " hónap :");
- valasz = Convert.ToByte(Console.ReadLine());
- Console.WriteLine();
- if (valasz == napok[idx_honap])
- {
- Console.WriteLine("A valasz helyes!");
- jo++;
- Console.WriteLine("Szeretnéd folytatni? (y/n)");
- if(Console.ReadKey().Key == ConsoleKey.N)
- {
- Console.Clear();
- Console.WriteLine("Nem folytattad..");
- break;
- }
- Console.ReadKey();
- Console.Clear();
- }
- else
- {
- Console.WriteLine("A válasz helytelen!");
- hibas++;
- Console.WriteLine("Szeretnéd folytatni? (y/n)");
- if (Console.ReadKey().Key == ConsoleKey.N)
- {
- Console.Clear();
- Console.WriteLine("Nem folytattad..");
- break;
- }
- Console.ReadKey();
- Console.Clear();
- }
- }
- Console.WriteLine("Jól sikerült: "+ jo +"\nHibás: " + hibas);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement