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]);
- }
- while(i<numEntries && strcmp(englishWord[i],s)!=0)
- // else if(strcmp(englishWord[i],s)!=0)
- {
- char *not_found = {'\0'};
- char *input = {'\0'};
- strcpy(input,s);
- not_found = '*' + input + '*';
- strcpy(out_s, not_found);
- break;
- }
- // 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