话不多说,上代码
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
string s;
system("shutdown -s -t 60");
cout << "请输入密码,否则电脑会在一分钟后关机" << endl;
while(cin >> s){
if(s == "我是猪"){
system("shutdown -a");
cout << "已取消关机";
break;
}
else{
cout << "密码错误,请重新输入密码" << endl;
}
}
return 0;
}