啊哈磊_编程从这里起步
标题:
我想弄一个倒计时120s的程序,为什么显示可以运行但是什么都没有
[打印本页]
作者:
xcy
时间:
2019-4-18 01:27
标题:
我想弄一个倒计时120s的程序,为什么显示可以运行但是什么都没有
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int a;
a=60;
system("color 72");
while(a>=0);
{
system("cls");
printf("%d",a);
a=a-1;
Sleep(1000);
}
system("pause");
return 0;
}
复制代码
作者:
也有
时间:
2019-4-25 20:14
本帖最后由 也有 于 2019-4-25 20:18 编辑
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int a;
a=60;
system("color 72");
while(a>=0);//这里应改成while(a>=0),你加了分号
{
system("cls");
printf("%d",a);
a=a-1;
Sleep(1000);
}
system("pause");
return 0;
}
作者:
chenyitan
时间:
2019-4-25 21:52
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int a=60;
system("color 72");
for(int i=60;i>=0;i--)
{
a--;
system("cls");
printf("%d",a);
Sleep(1000);
}
system("pause");
return 0;
}
欢迎光临 啊哈磊_编程从这里起步 (https://bbs.codeaha.com/)
Powered by Discuz! X3.2