C语言:goto语句实现电脑关机操作
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
char input[10] = { 0 };
system("shutdown -s -t 60");
again:
printf("电脑将在一分钟后关机,请输入‘我是猪’取消关机\n");
scanf("%s", &input);
if(strcmp(input, "我是猪")==0)
{
system("shutdown -a");
}
else
{
goto again;
}
return 0;
}