我有一个算法应该比较两个单独向量中的字符串并比较第一个向量文件的内容:fileContent 和 fileContent1。如果有字符串匹配,程序应打印出第一个向量的每一行,并报告向量二中是否有匹配的行(如果是这种情况,则打印出“YES:”Vector1 行或“No”Vector1 行)目前我的输出是这样的,我似乎无法弄清楚我做错了什么。任何提示或帮助将不胜感激。
我目前的输出:
NO:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:altimbankery
YES:loessoid
NO:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:loessoid
YES:stampede
YES:stampede
NO:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:stampede
YES:soger
YES:soger
YES:soger
NO:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:soger
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
NO:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:Plutarchical
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
NO:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:gigglesome
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
NO:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:unheated
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
NO:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:offendress
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
NO:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:syruper
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
NO:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:multispindle
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
NO:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:stinging
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
NO:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:Euspongia
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
NO:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:recluse
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
NO:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:continuum
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
NO:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:promotrix
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
NO:menyie
YES:menyie
YES:menyie
YES:menyie
YES:menyie
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
NO:perpetuator
YES:perpetuator
YES:perpetuator
YES:perpetuator
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
YES:hornblower
NO:hornblower
YES:hornblower
YES:hornblower
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
YES:kurung
NO:kurung
YES:kurung
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
YES:inductionally
NO:inductionally
文件1的内容:
unheated
rheometer
daemonurgy
maltase
morrowless
Plutarchical
czarism
missable
loessoid
siphonozooid
saltimbankery
unreduced
loglike
stampede
clickless
soger
gigglesome
vila
文件2的内容:
saltimbankery
loessoid
stampede
soger
Plutarchical
gigglesome
unheated
offendress
syruper
multispindle
stinging
Euspongia
recluse
continuum
promotrix
menyie
perpetuator
hornblower
kurung
inductionally
算法:
if(algo_speed == "slow")
{
i = 0;
while(getline(ifs1, line))
{
fileContent1.push_back(line);
fileContent.push_back(line);
}
for(size_t i = 0; i < fileContent1.size() ; i++)
{
for(size_t j = 0; j < fileContent.size() ; j++)
{
size_t found = fileContent[i].find(fileContent1[j]);
if(found) {
cout << "YES:" << fileContent.at(i) << endl;
} else {
cout << "NO:" << fileContent.at(i) << endl;
}
//sort(fileContent1.begin(), fileContent1.end());
}
}
}