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 tamagochi
- {
- public struct tamagochi
- {
- public String jmeno;
- public String typ;
- public int vek;
- public void nastavHodnoty(String tmJmeno, String tmTyp, int tmVek)
- {
- jmeno = tmJmeno;
- typ = tmTyp;
- vek = tmVek;
- }
- public void vypisZvire()
- {
- Console.WriteLine("Jmeno " + jmeno + " Typ " + typ + " Vek: " + vek);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- int body = 0;
- string[] pole = new string[10];
- int i = 0;
- tamagochi zvire = new tamagochi();
- Console.WriteLine("Zadej jmeno:");
- String jmeno = Console.ReadLine();
- Console.WriteLine("Zadej typ:");
- String typ = Console.ReadLine();
- Console.Write("Zadej vek: ");
- int vek = int.Parse(Console.ReadLine());
- zvire.nastavHodnoty(jmeno, typ, vek);
- zvire.vypisZvire();
- if (body == 50)
- {
- Console.WriteLine("zvire chciplo");
- Console.ReadKey();
- Environment.Exit(0);
- }
- else
- {
- Console.WriteLine("Zvol si operaci:");
- Console.WriteLine("1. nakrmeni zvirete");
- Console.WriteLine("2. jit na prochazku");
- Console.WriteLine("3. umyt");
- Console.WriteLine("4. uklidit pelech");
- Console.WriteLine("_____________________");
- int volba = int.Parse(Console.ReadLine());
- while (volba == 1 || volba == 2 || volba == 3 || volba == 4) ;
- {
- switch (volba)
- {
- case 1:
- Console.WriteLine("zvire nakrmeno");
- body = body + 5;
- pole[i] = "zvire nakrmeno";
- i++;
- break;
- case 2:
- Console.WriteLine("zvire vyvenceno");
- body = body + 5;
- pole[i] = "zvire vyvenceno";
- i++;
- break;
- case 3:
- Console.WriteLine("zvire umyto");
- body = body + 5;
- pole[i] = "zvire umyto";
- i++;
- break;
- case 4:
- Console.WriteLine("pelech uklizen");
- body = body + 5;
- pole[i] = "pelech uklizen";
- i++;
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement