【C语言】一分钟后关机

来源:互联网 发布:c语言图像识别 编辑:程序博客网 时间:2024/05/06 00:53
#include <stdio.h>#include <stdlib.h>#include <string.h>int main(){char input[10];system("shutdown -s -t 60");flag:printf("1分钟之后关机,请输入\"我是猪\"三个字解除\n");scanf("%s", input);if (strcmp(input, "我是猪") == 0){system("shutdown -a");}else{goto flag;}return 0;}补充:-s 是关闭此计算机 -t 是延迟多长时间关闭 ,后面跟秒数 例如 shutdown -s -t 60 意思是说60秒后关闭此计算机,shutdown -a是解除关机命令。

本文出自 “Vs吕小布” 博客,请务必保留此出处http://survive.blog.51cto.com/10728490/1701801

0 0