c语言 制作 倒计时?

Python022

c语言 制作 倒计时?,第1张

#include<stdio.h>#include<time.h>

int main(){ time_t start, end

int i

start = time(NULL)

end = time(NULL)

printf("please input:")

for(i = 0i <3i++){

while(end - start <i){

end = time(NULL)

}

cystem("cls")

printf("%d", i)

}

return 0

}

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

void wait ( int seconds )

{

clock_t endwait

endwait = clock () + seconds * CLK_TCK

while (clock() <endwait) {}

}

void main(){

int t,m,s

printf("input counterdown time in seconds\n")

scanf("%d",&t)

printf("\n===================\n")

while(1)

{

wait ( 1 )

t--

if (t==0) break

s = t % 60

m = t / 60

printf("\r\t%02d:%02d",m,s)

}

exit(0)

}