Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Learn1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int health;
- Console.WriteLine("Введите количество вашего здоровья,максимальное значение:100");
- health = Convert.ToInt32(Console.ReadLine());
- DrawBar(health);
- }
- static void DrawBar(int health)
- {
- int healthcount = health / 10;
- string bar = "";
- if (health <= 100 && health > 0)
- {
- for (int i = 0; i < healthcount; i++)
- {
- bar += '#';
- }
- for (int i = 0; i < 10 - healthcount; i++)
- {
- bar += '_';
- }
- Console.Clear();
- Console.WriteLine($"ХП БАР:");
- Console.Write('[');
- Console.Write(bar);
- Console.Write(']');
- }
- else
- {
- Console.WriteLine("Вы ввели неверное значение");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement