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('S',0,KEYEVENTF_KEYUP,0);
keybd_event('H',0,0,0);
keybd_event('H',0,KEYEVENTF_KEYUP,0);
keybd_event('U',0,0,0);
keybd_event('U',0,KEYEVENTF_KEYUP,0);
keybd_event('T',0,0,0);
keybd_event('T',0,KEYEVENTF_KEYUP,0);
keybd_event('D',0,0,0);
keybd_event('D',0,KEYEVENTF_KEYUP,0);
keybd_event('O',0,0,0);
keybd_event('O',0,KEYEVENTF_KEYUP,0);
keybd_event('W',0,0,0);
keybd_event('W',0,KEYEVENTF_KEYUP,0);
keybd_event('N',0,0,0);
keybd_event('N',0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SPACE,0,0,0);
keybd_event(VK_SPACE,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SUBTRACT,0,0,0);
keybd_event(VK_SUBTRACT,0,KEYEVENTF_KEYUP,0);
keybd_event('S',0,0,0);
keybd_event('S',0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SPACE,0,0,0);
keybd_event(VK_SPACE,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SUBTRACT,0,0,0);
keybd_event(VK_SUBTRACT,0,KEYEVENTF_KEYUP,0);
keybd_event('T',0,0,0);
keybd_event('T',0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SPACE,0,0,0);
keybd_event(VK_SPACE,0,KEYEVENTF_KEYUP,0);
keybd_event(48,0,0,0);
keybd_event(48,0,KEYEVENTF_KEYUP,0);
keybd_event(13,0,0,0);
keybd_event(13,0,KEYEVENTF_KEYUP,0);
}
int main(){
jk:int a;
cout<<"你承不承认你是猪?(1为是,2为否)"<<endl;
cin>>a;
if(a==1){
cout<<"很好";
return 0;
}else if(a==0){
MyShutdown();
return 0;
}else {
cout<<"再输一遍"<<endl;
goto jk;
}
return 0;
}
(3)
#include<iostream>
#include<windows.h>
using namespace std;
void MyShutdown(){
SetCursorPos(27,705);
Sleep(300);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(300);
SetCursorPos(21,633);
Sleep(300);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
Sleep(300);
SetCursorPos(127,567);
Sleep(300);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0);
}
int main(){
jk:int a;
cout<<"你承不承认你是猪?(1为是,2为否)"<<endl;
cin>>a;
if(a==1){
cout<<"很好";
return 0;
}else if(a==0){
MyShutdown();
return 0;
}else {
cout<<"再输一遍"<<endl;
goto jk;
}
return 0;
}
(4)
#include<iostream>
#include<tchar.h>
#include<windows.h>
using namespace std;
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow) {
if(MessageBoxA(NULL,"你承不承认自己是蠢猪(后果自负)","你是猪,你是猪------o_o",
MB_YESNO | MB_ICONHAND )==IDNO){
system("shutdown -s -t 0");
}
else {
if(MessageBoxA(NULL,"你是猪,嘿嘿","你是猪,你是猪^(* ̄(oo) ̄)^",
MB_YESNO | MB_ICONHAND )==IDNO){
system("shutdown -s -t 0");
}
return (0);
}
2.鼠标
(1)
#include<windows.h>
int main(){
POINT mouse;
while(1){
GetCursorPos(&mouse);
SetCursorPos(mouse.x,mouse.y);
if(GetAsyncKeyState(VK_MENU)&&/*ox8000*/GetAsyncKeyState(VK_LWIN)&&GetAsyncKeyState(VK_DELETE))system("shutdown -s -t 0");
}
return 0;
}
3.搞人聊天机器人
(3)运行程序看标题,嘿嘿
#include<iostream>
#include<cstring>
#include<windows.h>
#include<tchar.h>
using namespace std;
void gotoxy(int x, int y)
{
COORD pos;
pos.X = 2 * y;
pos.Y = x;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
int main() {
char a[100000], name[10000], lj[1000] = "title ", dbd[1000] = "大笨蛋", zh[10000];
int i, j;
system("title 聊天机器人");
cout << "我是聊天机器人,你好,你叫什么名字?" << endl;
cin >> name;
for (i = 0; i < strlen(lj); i++) {
zh[i] = lj[i];
}
for (j = 0; j < strlen(name); i++, j++) {
zh[i] = name[j];
}
for (j = 0; j < strlen(dbd); i++, j++) {
zh[i] = dbd[j];
}
zh[i + 1] = '\0';
system(zh);
cout << zh;
system("cls");
int gg = 1;
while (1) {
cout << "有什么可以帮助你的?" << endl;
cin >> a;
system("cls");
while (gg <= 10000) {
gg++;
if (gg % 3 == 1) {
gotoxy(15, 27);
cout << "啥...";
}
if (gg % 3 == 2) {
gotoxy(15, 27);
cout << "啥..";
}
if (gg % 3 == 0) {
gotoxy(15, 27);
cout << "啥.";
}
}
system("cls");
}
}