问题描述
这可能是一个远景,但是您会如何聪明地将二进制输出转换为在控制台中显示垂直二进制时钟?我有输出eksempel 10101(也已拆分或放入bool []中),我的问题是如何制作图形时钟。我的想法是将SetCursorPosistion与WriteLine(“███”)一起使用,并更改颜色的真假。但是我如何将输出“过滤”到正确的WriteLine(“███”)?有没有办法获取布尔数组的第一个索引?或最聪明的方法是什么?
我的转换器:
foreach (char est in resultss)
{
OneZeross = est - '0';
if (taller.OneZeross == 1)
{
Console.ForegroundColor = ConsoleColor.Blue; // Can convert it into a Bool[] instead
Console.WriteLine("1");
}
else
{
Console.ForegroundColor = ConsoleColor.Red; // Can convert it into a Bool[] instead
Console.WriteLine("0");
}
}
static void tegneRSS(int x,int y)
{
Console.SetCursorPosition(x,y);
Console.WriteLine("█");
Console.ForegroundColor = ConsoleColor.DarkGray;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)