首页 > 编程语言 > 详细

我的C/C++学习-----变色龙

时间:2018-07-21 15:44:56      阅读:163      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <time.h>

void main()
{
    int i = 0;
    char str[20];
    char strl[40];
    int    lTime = 0;
    srand((int)time(0));
    while (1)
    {
        i++;
        lTime++;
        sprintf_s(str, "color %x%x", rand() % 16, rand() % 16);
        system(str);
        printf("\n%s", str);
        sprintf_s(strl, "title 程序启动%d秒(Gabriel)", lTime);
        system(strl);
        Sleep(1000);
        if (20 == i)
        {
            system("cls");
        }
    }

}

 

我的C/C++学习-----变色龙

原文:https://www.cnblogs.com/seraphgabriel/p/9346634.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!