恶搞代码(1)

1.电脑关机或重启或疯狂说您的电脑已中毒

#include<bits/stdc++.h> 
#include<Windows.h> 
using namespace std;
int main() {
	cout<<"*******病毒5.00*******"<<endl;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED);  
	double a,b; 
	cin>>a>>b;
	cout<<a+b<<endl;
    if((a+b)>0){
    	system("shutdown /s /t 0");
	}else if(a+b<0){
		system("shutdown /r /t 0");
	}else{
		int n;  
    std::string message = "您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!您的电脑已中毒!";  
  
    while(true){
    	std::cout<<message<<std::endl;
	}
	}
    return 0;  
}
//如果a+b>0,则关机
//如果a+b=0,则说您的电脑已中毒
//如果a+b<0,则重启

2.鼠标乱飞

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int main(){
    while(1){
        SetCursorPos(rand()%1000,rand()%1000);
    }
}

3.字符串反转

#include <iostream>  
#include <string>  
using namespace std;  
int main() {  
    string input;  
    cout << "请输入一个字符串:";  
    getline(cin, input);  
    string reversed = "";  
    for (int i = input.length() - 1; i >= 0; i--) {  
        reversed += input[i];  
    }  
    cout << "反转后的字符串是:" << reversed << endl;  
    return 0;  
}

4.在控制台输出一些令人惊讶的消息

#include <iostream>  
#include <windows.h>  
int main() {  
    std::cout << "欢迎来到恶搞代码!" << std::endl;  
    system("color 0c"); // 改变控制台颜色为红色  
    std::cout << "你被愚弄了!" << std::endl;  
    system("pause"); // 暂停程序,等待用户按键  
    return 0;  
}

......

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值