C语言倒计时程序

用户输入一个时间,程序执行倒计时。

核心代码:

#include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    int main()
    {
        int a;
        printf("请输入要倒计时的时间:\n");
        scanf("%d",&a);
        system("color 0a");  
        while(a>=0)
        {
            system("cls");
            printf("%d",a);
            Sleep(1000);
            a=a-1;
        }
        system("pause");
    }

猜你喜欢

转载自blog.csdn.net/jmj18756235518/article/details/79888206
今日推荐