Advertisement
buresm

Tamagochi

Apr 11th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.07 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 tamagochi
  8. {
  9.     public struct tamagochi
  10.     {
  11.         public String jmeno;
  12.         public String typ;
  13.         public int vek;
  14.  
  15.         public void nastavHodnoty(String tmJmeno, String tmTyp, int tmVek)
  16.         {
  17.             jmeno = tmJmeno;
  18.             typ = tmTyp;
  19.             vek = tmVek;
  20.         }
  21.  
  22.         public void vypisZvire()
  23.         {
  24.             Console.WriteLine("Jmeno " + jmeno + " Typ " + typ + " Vek: " + vek);
  25.         }
  26.     }
  27.  
  28.  
  29.     class Program
  30.     {
  31.         static void Main(string[] args)
  32.         {
  33.             int body = 0;
  34.             string[] pole = new string[10];
  35.             int i = 0;
  36.             tamagochi zvire = new tamagochi();
  37.             Console.WriteLine("Zadej jmeno:");
  38.             String jmeno = Console.ReadLine();
  39.             Console.WriteLine("Zadej typ:");
  40.             String typ = Console.ReadLine();
  41.             Console.Write("Zadej vek: ");
  42.             int vek = int.Parse(Console.ReadLine());
  43.             zvire.nastavHodnoty(jmeno, typ, vek);
  44.  
  45.  
  46.             zvire.vypisZvire();
  47.  
  48.             if (body == 50)
  49.             {
  50.                 Console.WriteLine("zvire chciplo");
  51.                 Console.ReadKey();
  52.                 Environment.Exit(0);
  53.             }
  54.             else
  55.             {
  56.                 Console.WriteLine("Zvol si operaci:");
  57.                 Console.WriteLine("1. nakrmeni zvirete");
  58.                 Console.WriteLine("2. jit na prochazku");
  59.                 Console.WriteLine("3. umyt");
  60.                 Console.WriteLine("4. uklidit pelech");
  61.                 Console.WriteLine("_____________________");
  62.                 int volba = int.Parse(Console.ReadLine());
  63.                 while (volba == 1 || volba == 2 || volba == 3 || volba == 4) ;
  64.                 {
  65.                     switch (volba)
  66.                     {
  67.                         case 1:
  68.  
  69.                             Console.WriteLine("zvire nakrmeno");
  70.                             body = body + 5;
  71.                             pole[i] = "zvire nakrmeno";
  72.                             i++;
  73.                             break;
  74.  
  75.                         case 2:
  76.                             Console.WriteLine("zvire vyvenceno");
  77.                             body = body + 5;
  78.                             pole[i] = "zvire vyvenceno";
  79.                             i++;
  80.                             break;
  81.  
  82.                         case 3:
  83.                             Console.WriteLine("zvire umyto");
  84.                             body = body + 5;
  85.                             pole[i] = "zvire umyto";
  86.                             i++;
  87.                             break;
  88.  
  89.                         case 4:
  90.                             Console.WriteLine("pelech uklizen");
  91.                             body = body + 5;
  92.                             pole[i] = "pelech uklizen";
  93.                             i++;
  94.                             break;
  95.                     }
  96.                 }
  97.  
  98.             }
  99.  
  100.         }
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement