学习倒计时

#include <stdio.h>
#include <windows.h>
main()
{
	int m=0,s=0;
	printf("输入分秒,以空格间隔\n");
	scanf("%d %d",&m,&s);
	if (s>=60)
	{
		m+=s/60;
		s-=m*60;
	}
	printf("Press any key to continue\n");
	getch();
	while (m>=0)
	{
		while (s>=0)
		{
			system("cls");
			printf("剩余%02d分%02d秒\n",m,s);
			Sleep(1000);
			s--;
		}
		m--;
		s=59;
	}
	system("cls");
}


运行结果:

说说:学习学习。。。。

原文地址:https://www.cnblogs.com/javawebsoa/p/3089307.html