Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- Avatar[] Avatars = new Avatar[2] { new Avatar(), new Avatar()};
- Console.WriteLine("Введите имя Хомяка №1 :");
- Avatars[0].Name = Console.ReadLine();
- Console.WriteLine("Введите имя Хомяка №2 :");
- Avatars[1].Name = Console.ReadLine();
- //Avatars[1].Feed(20);
- //Avatars[0].Feed(10);
- Console.WriteLine("Кому подкинуть хавки? :");
- switch (Console.ReadLine())
- {
- case "Avatars[0].Name":
- Avatars[0].Feed(-10);
- break;
- case "Avatars[1].Name":
- Avatars[1].Feed(-20);
- break;
- default:
- break;
- }
- Console.WriteLine(Avatars[1].Hunger);
- Console.WriteLine(Avatars[0].Hunger);
- }
- }
- class Avatar
- {
- public int Money, Fatigue, Hunger;
- public string Name;
- public void Feed(int foodCount)
- {
- this.Hunger -= foodCount;
- this.Fatigue += foodCount / 4;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement