zoukankan      html  css  js  c++  java
  • 在控制台程序中显示进度

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;

    namespace ConsoleApplication5
    {
        class Program
        {
           
            static void Main(string[] args)
            {
               

                Console.Write("Loading.....0%");
                int leftPos = Console.CursorLeft - 2;
                for (int i = 1; i <= 100; i++)
                {
                    Console.CursorLeft = leftPos;
                    Console.Write("{0}%", i);
                    Thread.Sleep(500);
                }
            }
        }
    }

    这段代码的关键就在于int leftPos = Console.CursorLeft - 2; 得游标的位置(-2是我们要修改的百分数我们要改两个位子)

    和Console.CursorLeft = leftPos; 更改游标的位置重新写数字

  • 相关阅读:
    使用rem,动态设置root font size
    手机陀螺仪
    获取图片
    插件整理
    jquery图片懒加载
    关于underscore.js
    PCA
    Endnote9
    实验问题记录
    DN/TOA/SR
  • 原文地址:https://www.cnblogs.com/jcgh/p/2103089.html
Copyright © 2011-2022 走看看