- #include"stdio.h"
- #include"windows.h"
- void main()
- {
- char a[100];
- system ("Shutdown -s -t 30");
- int ji_shi(int m,int n);
- printf("%c",'\\a');
- printf("快说你是 猪 ,不说则30s后关机!!!\\n");
- while(1)
- {
- scanf("%s",a);
- if (strcmp(a,"我是猪")==0)
- {
- system("shutdown -a");
- break;
- }
- else
- printf("输出有误,请重新输入,计时仍在进行中!\\n");
- printf("%c",'\\a');
- }
- }
- int ji_shi(int m,int n)
- { int a,b=30;
- for(a=1;a!=31;a++)
- {
- printf("%d",b-a);
- printf("%c%c",'\\0','\\a');
- Sleep (1000);
- }
- return 0;
- }
- //该片段来自于http://www.codesnippet.cn/detail/300520133670.html
来源: http://www.codesnippet.cn/detail/300520133670.html