Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Gierka
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int liczba = -1 ;
  13.             int liczba2;
  14.             int zmienna2;
  15.             string wybor;
  16.             string wybor2;
  17.             int zmienna;
  18.  
  19.                 do
  20.                 {
  21.                     zmienna = 0;
  22.                     zmienna2 = 0;
  23.                     Console.WriteLine("Wybierz poziom trudnosci:");
  24.                     Console.WriteLine(" 1.latwy (przedzial 1-10)\n 2.sredni (przedzial 1-30)\n 3.trudny (przedzial 1-50)");
  25.                     wybor = Console.ReadLine();
  26.                         if (wybor == "1")
  27.                         {
  28.                             Random rand = new Random();
  29.                             liczba = rand.Next(0, 10);
  30.                         }
  31.                         if (wybor == "2")
  32.                         {
  33.                             Random rand = new Random();
  34.                             liczba = rand.Next(0, 30);
  35.                         }
  36.                         if (wybor == "3")
  37.                         {
  38.                             Random rand = new Random();
  39.                             liczba = rand.Next(0, 50);
  40.                         }
  41.                     do
  42.                     {
  43.                         Console.WriteLine("Wpisz Liczbe");
  44.                         wybor2 = Console.ReadLine();
  45.                         liczba2 = int.Parse(wybor2);
  46.                         if (liczba2 == liczba)
  47.                         {
  48.                             zmienna2 = 1;
  49.                             Console.WriteLine("Brawo, zgadles!");
  50.                             Console.WriteLine("Chcesz zagrac jeszcze raz ? T/N");
  51.                             wybor2 = Console.ReadLine();
  52.                             if (wybor2 == "T" || wybor2 == "t")
  53.                             {
  54.                                 zmienna = 1;
  55.                             }
  56.                             else
  57.                                 zmienna = 0;
  58.                         }
  59.                         if (liczba2 < liczba)
  60.                         {
  61.                             Console.WriteLine("Wprowadzona liczba jest mniejsza od tej ktora masz zgadnac");
  62.                         }
  63.                         if (liczba2 > liczba)
  64.                         {
  65.                             Console.WriteLine("Wprowadzone liczba jest wieksza od tej ktora masz zagnac");
  66.                         }
  67.                     }
  68.                     while (zmienna2 == 0);
  69.                 }
  70.                     while (zmienna == 1);
  71.                 }
  72.     }
  73.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement