Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HomeWorks
- {
- class Program
- {
- static void Main(string[] args)
- {
- int barMaxPercent = 100;
- int barPercent;
- string userInput = "";
- char barSimbol;
- int percentageDivider = barMaxPercent / 10;
- while (userInput != "exit")
- {
- Console.Write("Введите процент заполненности bar: ");
- barPercent = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите символ, которым будет заполнен bar: ");
- barSimbol = Convert.ToChar(Console.ReadLine());
- DrawBar(barPercent,barSimbol, percentageDivider);
- }
- }
- static void DrawBar(int barPercent, char barSimbol, int percentageDivider)
- {
- Console.Clear();
- int barFullness = barPercent / percentageDivider;
- int barUnfilledPart = percentageDivider;
- Console.Write("[");
- do
- {
- Console.Write(barSimbol);
- barFullness--;
- barUnfilledPart--;
- }
- while (barFullness > 0);
- for (int i = barUnfilledPart; i > 0; i--)
- {
- Console.Write("_");
- }
- Console.WriteLine($"] {barPercent}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement