Neon1x1st

HMfA2

Mar 14th, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace CSharpLight
  7. {
  8.  
  9. public static class Program
  10. {
  11. public static void Main()
  12. {
  13. int health = 100;
  14. int damage = 5;
  15.  
  16. int enemyHealth = 60;
  17. int enemyDamage = 8;
  18.  
  19. while(health > 0 && enemyHealth > 0)
  20. {
  21. Console.WriteLine("На вас напали!");
  22. Console.Write("hit - сражаться,exit - бежать.Ваш выбор:");
  23. string inputPlayer = Console.ReadLine();
  24.  
  25. if (inputPlayer == "exit")
  26. {
  27. break;
  28. }
  29. if (inputPlayer == "hit")
  30. {
  31. health -= enemyDamage;
  32. enemyHealth -= damage;
  33. }
  34. else
  35. {
  36. Console.WriteLine("У вас всего две команды:hit и exit.Пожалуйста сделайте выбор:");
  37. }
  38.  
  39. Console.WriteLine(health);
  40. Console.WriteLine(enemyHealth);
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment