C++搞人程序
1.关机
(1)
#include<windows.h>
#include<iostream>
using namespace std;
int main(){
jk:int a;
cout<<"你承不承认你是猪?(1为是,2为否)"<<endl;
cin>>a;
if(a==1){
cout<<"很好";
return 0;
}else if(a==0){
system("shutdown -s -t 0");
return 0;
}else {
cout<<"再输一遍"<<endl;
goto jk;
}
return 0;
}
(2)
#include<iostream>
#include<windows.h>
#include<Windows.h>
#include<tchar.h>
using namespace std;
void MyShutdown(){
keybd_event(91,0,0,0);
keybd_event(82,0,0,0);
keybd_event(91,0,KEYEVENTF_KEYUP,0);
keybd_event(82,0,KEYEVENTF_KEYUP,0);
Sleep(300);
keybd_event('C',0,0,0);
keybd_event('C',0,KEYEVENTF_KEYUP,0);
keybd_event('M',0,0,0);
keybd_event('M',0,KEYEVENTF_KEYUP,0);
keybd_event('D',0,0,0);
keybd_event('D',0,KEYEVENTF_KEYUP,0);
keybd_event(13,0,0,0);
keybd_event(13,0,KEYEVENTF_KEYUP,0);
Sleep(1000);
keybd_event('S',0,0,0);
keybd_event(