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;
- namespace Task2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Сколько % жизней у вашего героя?");
- int health = Convert.ToInt32(Console.ReadLine());
- DrawHealtBar(health);
- Console.ReadKey();
- }
- static void DrawHealtBar(int health, char fillSymbol = '#', char voidSymbol = '_', int left = 55, int top = 0)
- {
- Console.SetCursorPosition(left, top);
- char[] simbols = new char[10];
- for (int i = 0; i < simbols.Length; i++)
- {
- simbols[i] = voidSymbol;
- }
- if (health <= 100)
- {
- string bar = "";
- for (int i = 0; i < health / 10; i++)
- {
- simbols[i] = fillSymbol;
- }
- for (int i = 0; i < simbols.Length; i++)
- {
- bar += simbols[i];
- }
- Console.WriteLine("[" + bar + "]");
- }
- else
- {
- Console.WriteLine("Это не проценты!");
- }
- Console.SetCursorPosition(0, 2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement