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;
- using System.Threading.Tasks;
- namespace Homework2
- {
- class Program
- {
- static void Main(string[] args)
- {
- char fill = '#';
- int fillPercent = 40;
- int maxValue = 10;
- int positionY = 1;
- DrawBar(fillPercent,maxValue,fill,positionY);
- }
- static void DrawBar(int fillPercent, int maxValue, char fill, int positionY)
- {
- int value = fillPercent * maxValue / 100 ;
- Console.CursorVisible = false;
- Console.SetCursorPosition(0, positionY);
- Console.Write('[');
- for (int i = 0; i < value; i++)
- {
- Console.Write(fill);
- }
- for (int i = value; i < maxValue; i++)
- {
- Console.Write('_');
- }
- Console.Write(']');
- }
- }
- }
Add Comment
Please, Sign In to add comment