#includestdio.h#includetime.h
int main(){ time_t start, end;
int i;
start = time(NULL);
end = time(NULL);
printf("please input:");
while(end - start i){
}
cystem("cls");
printf("%d", i);
return 0;
可以调用系统命令
在程序中加入这句
还可以有更高级的用法,指定时间关机
system("at 10:00 shutdown -s -f"); /*在10:00关机*/
system("shutdown -a");
对了,要用system()函数需要加一个头文件 stdlib.h
①.、C语言中实现精确计时,参考代码如下:
ANSIC: ftime()
struct timeb {
time_t time;
unsigned short millitm;
short timezone;
short dstflag;
};
LARGE_INTEGER frequency = {0};
LARGE_INTEGER now = {0};
LARGE_INTEGER end = {0};
QueryPerformanceFrequency(frequency);
while (QueryPerformanceCounter(now) ((now.QuadPart - end.QuadPart) 0))
{
Sleep(0);
#include stdio.h
int main()
printf("hello world");
printf("%d",i);
Sleep(1000);
以上就是土嘎嘎小编为大家整理的c语言框倒计时函数相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!