Advertisement
voldmaks

UIELEMENT

Jul 16th, 2021
1,201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace UIELEMENT
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int value = 4;
  14.             int maxValue = 10;
  15.  
  16.             DrawBar(value, maxValue);
  17.         }
  18.  
  19.         static void DrawBar(int value, int maxValue)
  20.         {
  21.             string bar = "";
  22.  
  23.             for (int i = 0; i < value; i++)
  24.             {
  25.                 bar += '#';
  26.             }
  27.  
  28.             Console.SetCursorPosition(0, 0);
  29.             Console.Write('[');
  30.             Console.Write(bar);
  31.  
  32.             bar = "";
  33.  
  34.             for (int i = value; i < maxValue; i++)
  35.             {
  36.                 bar += '_';
  37.             }
  38.             Console.Write(bar + ']');
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement