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

#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");
        }
    }

}

 

posted @ 2018-07-21 14:31  LifeOverflow  阅读(479)  评论(0编辑  收藏  举报