Comparing two arrays in c++ -
void evaluate(){ (i=0; i<200; i++){ if (phrase[i][2]==name[cmax-1]){ phrase[i][0]=phrase[i][0]+50; } (j=0; j<50; j++){ if (phrase[i][j]==52){ lsyl[0]=phrase[i][j-1]; lsyl[1]=phrase[i][j-2]; lsyl[2]=phrase[i][j-3]; lmax=j; break; } } if (lsyl[0] == name[0] && lsyl[1] == name[1] && lsyl[2] == name[2] && name[0] != 8){ phrase[i][0]=phrase[i][0]+1500; }else if (lsyl[0] == name[0] && lsyl[1] == name[1] && name[0] != 8){ phrase[i][0]=phrase[i][0]+150; }else if (lsyl[0] == name[0] && name[0] != 8){ phrase[i][0]=phrase[i][0]+50; } (j=2; j<lmax-2; j++){ (k=0; k<cmax; k++){ if (phrase[i][j] == name[k] && phrase[i][j+1] == name[k+1] && phrase[i][j+2] == name[k+2]){ phrase[i][0]=phrase[i][0]+1000; }else if (phrase[i][j] == name[k] && phrase[i][j+2] == name[k+2]){ phrase[i][0]=phrase[i][0]+100; }else if (phrase[i][j] == name[k] && phrase[i][j+2] == name[k+2]){ phrase[i][0]=phrase[i][0]+100; }else if (phrase[i][j] == name[k]){ phrase[i][0]=phrase[i][0]+1; } } } } }
this function program i'm working on. program takes name array name[] phonetically , compares 200 idioms common sounds , common combinations of sounds (e.g. kelly , jelly)
right evaluate function works, there combinations missing , wondering if overlooking easy way of comparing them front back; mean starting looking @ last sound in phrase first sound in name, way first sound in phrase being compared last sound in name.
cmax how long name lmax how long phrase is, have terminating 52 @ end of phrase
Comments
Post a Comment