计时3分钟的程序

//一个计时3分钟的程序

#include <iostream>

//延时函数Sleep()需要的头文件
#include<Windows.h>


using namespace std;

int main()
{

    int min=2;

    redo:
    int sec=59;

    while (min > 0)
    {

//延时函数 Sleep(1000ms);


        Sleep(1000);
        system("cls");
        cout << min << ":" << sec << endl;
        sec--;
        if (sec < 0)
        {
            min--;
            goto redo;
        }
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_42817985/article/details/117086593