偶尔用codeblock编一个小程序,很简单,如下:
#include <stdio.h>
#include <stdlib.h>
#include <string >
#include <iostream>
using namespace std;
int main()
{
string clear_text;
int cycle=0;
cout<< "please input the clear_text:";
getline(cin,clear_text);
cout << "please input the periodicity:" ;
cin >> cycle;
cout << cycle;
return 0;
}
运行没有结果:
不仅如此,每次敲这段代码,电脑杀毒软件都会提示我这段程序是木马
尝试删除重新建c++文件,也会提示木马。
于是,开始测试是哪句话出了问题,经过多次测试发现,在main函数中,除了必要的两条声明变量语句,其余四条语句:
cout<< "please input the clear_text:";
getline(cin,clear_text);
cout << "please input the periodicity:" ;
cin >> cycle;
cout << cycle;
删去任意一条,程序都可以正常运行;
除此之外,我还把两条声明语句,放在main函数外,程序仍然可以正常运行。
对木马的组成并不了解,所以不知道是什么造成被杀毒软件不识别。