Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите размер строки жизней:");
- int sizeHealthbar = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите процент заполнения строки жизней:");
- int percentHealthbar = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите размер строки маны:");
- int sizeManabar = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите процент заполнения строки маны:");
- int percentManabar = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- DrawBar(sizeHealthbar, percentHealthbar, '#', '_', 0);
- DrawBar(sizeManabar, percentManabar, '#', '_', 1);
- }
- static void DrawBar(int size, int percent, char symbol1, char symbol2, int position)
- {
- int transferPercentBar = (size * percent) / 100;
- string bar = "";
- for (int i = 0; i < transferPercentBar; i++)
- {
- bar += symbol1;
- }
- Console.SetCursorPosition(0, position);
- Console.Write('[');
- Console.Write(bar);
- bar = "";
- for (int i = transferPercentBar; i < size; i++)
- {
- bar += symbol2;
- }
- Console.Write(bar + ']');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement