• 方法---------拖延,清屏,前景色,背景色


    1、拖延

    System.Threading.Thread.Sleep(100);

    100--100毫秒

    例子:

    Console.WriteLine("你好"); //显示“你好!”
    System.Threading.Thread.Sleep(2000); //拖2秒进行下一步
    Console.WriteLine("你也是!"); //显示“你也是!”
    System.Threading.Thread.Sleep(2000); //拖2秒进行下一步

    console.readline();//输入---默认输入字符串

    2、清屏

     Console.Clear();

    前景色/背景色

    Console.ForegroundColor=ConsoleColor.Blue;
    Console.BackgroundColor = ConsoleColor.Blue;

    抽奖滚动案例:

    Console.WriteLine("本期中奖号码:12345");
    System.Threading.Thread.Sleep(100);
    Console.Clear();
    Console.WriteLine("本期中奖号码:54645");
    System.Threading.Thread.Sleep(100);
    Console.Clear();
    Console.WriteLine("本期中奖号码:45647");
    System.Threading.Thread.Sleep(100);
    Console.Clear();
    Console.WriteLine("本期中奖号码:123456");

    练习题

     //输入手机号,显示中奖号
            static void Main(string[] args)
            {   //输入
                Console.WriteLine("请输入要抽奖的人数:");
                int renshu = Convert.ToInt32(Console.ReadLine());
                //输入要抽奖人的手机号   
                string[] no = new string[renshu];
                for (int i = 0; i < renshu; i++)
                {
                    Console.Write("请输入抽奖人的手机号:");
                    no[i] = Console.ReadLine();
                }
                Console.WriteLine("所有人的手机号已经输入,请按回车键开始抽奖:");
                Console.Clear();
                //运算+输出
                Random rand = new Random();
                for (int i = 0; i < 30; i++)
                {
                    Console.Clear();
                    int a = rand.Next(renshu);
                    Console.WriteLine("本期中奖号码为:{0}", no[a]);
                    System.Threading.Thread.Sleep(100);//实现滚动效果
                }
    
            }
  • 相关阅读:
    mysql——mysql各个集群方案 (转)
    Actor——调度器Dispatcher
    记录的好处
    复习
    mysql中的weekofyear,yearweek函数的使用
    安吉丽娜朱莉访问乌克兰
    https://blog.csdn.net/weixin_35917052/article/details/116995151
    时间数列
    这些点赞的比较多
    Mysql锁类型分析
  • 原文地址:https://www.cnblogs.com/jinshui/p/5431497.html
Copyright © 2020-2023  润新知