Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Dictionary::translate(char out_s[MAX_WORD_LEN], const char s[MAX_WORD_LEN])
- {
- int i = 0;
- for (i=0;i<numEntries;i++)
- {
- if (strcmp(englishWord[i], s)==0)
- break;
- }
- /* if ( i<numEntries){
- strcpy(out_s, elvishWord[i]);*/
- for(int i = 0; i<numEntries;i++)
- {
- char *not_found = {'\0'};
- if(strcmp(englishWord[i],s)!=0)
- {
- // do{out_s[i] ='\0';i++;}while(i<MAX_WORD_LEN);
- int leng = 0;
- leng = strlen(s);
- for( int i = 0; i < leng; i++)
- {
- strcpy(not_found,s);
- not_found[i+1] = not_found[i];
- not_found[0] = '*';
- not_found[leng-1] = '*';
- }
- //strcpy(out_s,not_found);
- break;
- }
- // strcpy(out_s,not_found);
- }
- if ( i<numEntries){
- strcpy(out_s, elvishWord[i]);
- // what do I do if I didn't find the word?
- // might want another parameter or return value what
- // indicates that the word wasn't found
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment