Advertisement
aurimas12

Untitled

Mar 17th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.32 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace KartojimasND1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //1.Uzduotis
  14.             string user = "admin";
  15.             string pass = "1234";
  16.  
  17.             string input = "";
  18.             bool teisingai = false;
  19.             while (!teisingai)
  20.             {
  21.                 Console.WriteLine("prasome ivesti prisijungimo varda");
  22.                 input = Console.ReadLine();
  23.  
  24.                 if (input != "admin")
  25.                     Console.WriteLine("NETEISINGAI!!!");
  26.                 else
  27.                     teisingai = true;
  28.             }
  29.             Console.WriteLine("prasome ivesti prisijungimo slaptazodi");
  30.             string slaptas = Console.ReadLine();
  31.            
  32.             if (pass != slaptas)
  33.             {
  34.                 Console.WriteLine("Neteisingas vartotojo slaptazodis");
  35.             }
  36.             else
  37.                 Console.WriteLine("Sveikiname prisijungus");
  38.             Console.ReadLine();
  39.  
  40.             // 2.Uzduotis
  41.  
  42.             int jega;
  43.             int taiklumas;
  44.             string ginklas = "";
  45.  
  46.             Random rnd = new Random();
  47.             jega = rnd.Next(1, 7);
  48.             taiklumas = rnd.Next(1, 7);
  49.  
  50.             Console.WriteLine("Radai sautuva(1) ir kastuva(2)");
  51.             string input = Console.ReadLine();
  52.             if (input == "1")
  53.             {
  54.                 ginklas = "sautuvas";
  55.             }
  56.             else
  57.                 ginklas = "kastuvas";
  58.  
  59.             Console.WriteLine("Zaidejuo jega: " + jega + ",taiklumas: " + taiklumas + ",ginklas: " + ginklas);
  60.  
  61.             Console.WriteLine("Sutikai zombi! Begi ar kovoji?");
  62.             string ats = Console.ReadLine();
  63.  
  64.             if (ats == "begu")
  65.             {
  66.                 int sk = rnd.Next(1, 7);
  67.                 if (sk > 3) {
  68.                     Console.WriteLine("Spejai pabegti");
  69.                 }
  70.                 else if (sk < 3)
  71.                 {
  72.                     Console.WriteLine("Zombis tave suvalge");
  73.                 }
  74.                 Console.ReadLine();
  75.             }
  76.             else if (ats == "kovoju")
  77.             {
  78.                 int sk1 = rnd.Next(1, 7);
  79.                 if (input == "1")
  80.                 {
  81.                     taiklumas += sk1;
  82.                     Console.WriteLine("Tavo taiklumas: " + taiklumas);
  83.  
  84.                     if (taiklumas > 5)
  85.                     {
  86.                         Console.WriteLine("Laimejai");
  87.                     }
  88.  
  89.                     else if (taiklumas < 5)
  90.                     {
  91.                         Console.WriteLine("Pralaimejai");
  92.                     }
  93.                 }
  94.                 else if (input == "2")
  95.                     {
  96.                         jega += sk1;
  97.                         Console.WriteLine("Tavo jega: " + jega);
  98.  
  99.                         if (jega > 5)
  100.                         {
  101.                             Console.WriteLine("Laimejai");
  102.                         }
  103.                         else if (jega < 5)
  104.                         {
  105.                             Console.WriteLine("Pralaimejai");
  106.                         }
  107.                     }
  108.                 Console.ReadLine();
  109.             }
  110.         }
  111.     }
  112.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement