Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Healthbar
- {
- class Program
- {
- static string vvod(ref string prozent)
- {
- prozent = Console.ReadLine();
- return prozent;
- }
- static void Drawbar (double value,double maxvalue)
- {
- ConsoleColor defaultColor = Console.BackgroundColor;
- string bar = "";
- for(int i=0;i<(value/10-1);i++)
- {
- bar += '#';
- }
- Console.SetCursorPosition(0, 0);
- Console.Write("[");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.Write(bar);
- bar = "";
- Console.BackgroundColor = defaultColor;
- for (int i = 0; i <maxvalue/10- ((value / 10) - 1); i++)
- {
- bar += '_';
- }
- Console.Write(bar);
- Console.Write("]");
- }
- static void Main(string[] args)
- {
- double health=0 ;
- double maxhealth=100;
- Console.WriteLine("Введите процент health");
- health=Convert.ToDouble(Console.ReadLine());
- Console.Clear();
- Drawbar(health, maxhealth);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment