Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region туман
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace homework
- {
- #endregion
- class Program
- {
- static bool life = true;
- static string name;
- static void Main(string[] args)
- {
- Console.WriteLine("Введите имя ");
- name = Console.ReadLine();
- Console.WriteLine("Введите возраст " + name);
- byte old = Convert.ToByte(Console.ReadLine());
- sbyte health = 100;
- while ( life ==true )
- health = damage(old,health);
- Console.ReadLine();
- }
- static sbyte damage(byte old,sbyte health)
- {
- Console.WriteLine("Введите количество урона ");
- byte Damage = Convert.ToByte(Console.ReadLine());
- if (health > Damage)
- {
- health = Convert.ToSByte(health - Damage);
- Console.Clear();
- Console.Write("Имя: " + name);
- Console.WriteLine("; здовье- " + health + "; возраст " + name + " -" + old + ".");
- return health;
- }
- else
- {
- health = 0;
- life = false;
- Console.WriteLine(name + " умер!");
- name = "deathUser";
- return health;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement