Tuesday, 10 September 2013

Problems with Vector to Vector String Comparison Search

Problems with Vector to Vector String Comparison Search

pI have an algorithm that's supposed to compare the strings in two
separate vectors and compare the content of the first vector file :
fileContent with fileContent1. If there is a string match the program
should print out each line of the first Vector and report if there is a
line in vector two that matches (if this is the case print out YES:
Vector1 line or No Vector1 line) at the moment my output is this and I
can't seem to figure out what I am doing wrong. Any tips or help would be
appreciated. /p pMy output at the moment:/p precodeNO: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 /code/pre pContents of file1: /p precodeunheated
rheometer daemonurgy maltase morrowless Plutarchical czarism missable
loessoid siphonozooid saltimbankery unreduced loglike stampede clickless
soger gigglesome vila /code/pre pContents of file2:/p precodesaltimbankery
loessoid stampede soger Plutarchical gigglesome unheated offendress
syruper multispindle stinging Euspongia recluse continuum promotrix menyie
perpetuator hornblower kurung inductionally /code/pre pAlgorithm:/p
precodeif(algo_speed == slow) { i = 0; while(getline(ifs1, line)) {
fileContent1.push_back(line); fileContent.push_back(line); } for(size_t i
= 0; i lt; fileContent1.size() ; i++) { for(size_t j = 0; j lt;
fileContent.size() ; j++) { size_t found =
fileContent[i].find(fileContent1[j]); if(found) { cout lt;lt; YES: lt;lt;
fileContent.at(i) lt;lt; endl; } else { cout lt;lt; NO: lt;lt;
fileContent.at(i) lt;lt; endl; } //sort(fileContent1.begin(),
fileContent1.end()); } } } /code/pre

No comments:

Post a Comment