kisame1313

Lecture_2

Aug 24th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 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 ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.        static bool UserDeath = false;
  12.        static int Health = 100;
  13.        static int CurrentHealth;
  14.        static int DMG;
  15.        static string UserDmg;
  16.        static string UserName;
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.            
  21.             Console.WriteLine("Ваше имя?");
  22.             UserName = Console.ReadLine();
  23.             Console.Clear();
  24.             Console.ForegroundColor = ConsoleColor.Yellow;
  25.             Console.WriteLine(UserName.PadLeft(20));
  26.             Console.ForegroundColor = ConsoleColor.Green;
  27.             Console.WriteLine("       Ваше здоровье = " + Health);
  28.             Console.ForegroundColor = ConsoleColor.Red;
  29.             Console.WriteLine("  Какой урон вы хотите нанести " + UserName);
  30.             UserDmg = Console.ReadLine();
  31.             DMG = Convert.ToInt32(UserDmg);
  32.             CurrentHealth = Health - DMG;
  33.             if (CurrentHealth > 0) { }
  34.             else
  35.             {
  36.                 UserDeath = true;
  37.                 string DeathUser = UserName;
  38.             }
  39.             Console.WriteLine("      Осталось здоровья: " + CurrentHealth);
  40.             Console.ReadLine();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment