2代关机系统,可设制关机时间:
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int a,b;
int main(){
for(;;){
cout<<"电脑关机器1.2"<<endl;
cout<<"1.立刻关机"<<endl;
cout<<"2.设置关机"<<endl;
cout<<"3.取消关机并关闭系统(立刻关机无效)"<<endl;
cin>>a;
if(a==1){
system("Cls");
system("shutdown -a");
system("shutdown -f -s -t 0");
exit(0);
}
if(a==2){
cin>>b;
cout<<"设置成功!!!"<<endl;
_sleep(1000);
system("shutdown -a");
system("shutdown -f -s -t b");
exit(0);
}
if(a==3){
cout<<"设置成功!!!"<<endl;
_sleep(1000);
system("shutdown -a");
exit(0);
}
}
return 0;
}