//vs2013下编译通过.换别的编译器自行补充头文件和修改源代码
#include<iostream>
#include<fstream>
#include <string>
using namespace std;
char temp[256];//存放的临时数组
char virus[20];//病毒数组
char DNA[20];//DNA的数组
int j = 0;//病毒长度
int DNAlength = 0;//dna长度
int flag = 0;//判断是不是感染开关
void toCharArry(string str)//将读入的字符串转化为字符数组
{
j = 0;
int tem=0;
strcpy_s(temp, str.c_str());
//cout << str.length();
for (int i = 0; i < str.length(); i++)//找到空格的位置
{
if (temp[i] == ' '){ j=(i+1); break; }
}
tem = j;
for (int i = 0; i < str.length() - j + 1;i++)//写入DNA数组;
{
DNA[i] = temp[tem];
if (i == str.length() - j){
DNA[i] =
数据结构第二版之(课后题)BF算法病毒感染检测
最新推荐文章于 2024-05-15 14:47:43 发布