
#include<stdio.h> #include<stdlib.h> #include<windows.h> int main() { unsigned timer=3; char op; printf("welcome!\n"); while(timer != 0) { Sleep(1000);timer--; } system("cls"); scanf("%c",&op); if(op == 'q') exit(0); else /* dosomething... */ return 0; }
linux:

#include<stdio.h> #include<stdlib.h> int main() { unsigned timer=3; char op; printf("welcome!\n"); while(timer != 0) { sleep(1);timer--; } system("clear"); scanf("%c",&op); if(op == 'q') exit(0); else /* dosomething... */ return 0; }
[此贴子已经被作者于2016-6-5 19:11编辑过]