So I'm trying to use this code to print a statement if it reaches the end of the loop without break being called in the statement before it which would mean that the program got a match and then needs to print it. However, my if (k+1...) statement never gets branched into always skipped over. Why would this be?
else {
cout << "test" << endl;
looklen = look.length();
for (j = 0;j < numdist;j++) {
for (k = 0;k < looklen;k++) {
//cout << "test2" << endl;
if (look[k] = '?') {
k++;
continue;
}
else if (look[k] != distinct[j][k]) {
break;
}
if (k + 1 == looklen) {
cout << "test3" << endl;
cout << look << " : matches " << distinct[j] << " " << distinctnum[j]+1 << " time(s)." << endl;
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire