啊哈磊_编程从这里起步
标题:
60秒倒计时
[打印本页]
作者:
tjq200236
时间:
2013-8-17 11:18
标题:
60秒倒计时
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
a=60;
while(a>=0)
{
system("cls");
printf("%d",a);
Sleep(1000);
a=a-1;
}
system("pause");
return 0;
}
哪位大神还能把这个代码修改成,输入数字然后根据这个数字来倒计时
作者:
zncj
时间:
2013-8-19 10:25
只要把a=60; 这行改为scanf("%d",&a); 就可以了。
作者:
909368135
时间:
2013-8-19 19:11
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
scanf("%d",&a);
while(a>=0)
{
system("cls");
printf("%d",a);
Sleep(1000);
a=a-1;
}
system("pause");
return 0;
}
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2