Advertisement
levamurashev2002

Untitled

Jul 1st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 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 ConsoleApp8
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.WriteLine("Введите колво хп от 0 до 10");
  14. hpbar(Convert.ToInt32(Console.ReadLine()));
  15. }
  16. static void hpbar(int i)
  17. {
  18. char[] hp = new char[10];
  19. for (int g = 0; g < i; g++)
  20. {
  21. hp[g] = Convert.ToChar("#");
  22. }
  23. for (int h = 0; h < hp.Length; h++)
  24. {
  25. if (hp[h] != Convert.ToChar("#"))
  26. {
  27. hp[h] = Convert.ToChar("_");
  28. }
  29. }
  30. Console.Write("[");
  31. for (int h = 0; h < hp.Length; h++)
  32. {
  33. Console.Write(hp[h]);
  34. }
  35. Console.Write("]");
  36. Console.WriteLine();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement