davemx_5

Untitled

May 16th, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. void Dictionary::translate(char out_s[MAX_WORD_LEN], const char s[MAX_WORD_LEN])
  2. {
  3. int i = 0;
  4. for (i=0;i<numEntries;i++)
  5. {
  6. if (strcmp(englishWord[i], s)==0)
  7. break;
  8.  
  9.  
  10.  
  11. if(i<numEntries)
  12. {
  13. strcpy(out_s, elvishWord[i]);
  14. }
  15.  
  16. while(i<numEntries && strcmp(englishWord[i],s)!=0)
  17. // else if(strcmp(englishWord[i],s)!=0)
  18. {
  19. char *not_found = {'\0'};
  20. char *input = {'\0'};
  21. strcpy(input,s);
  22. not_found = '*' + input + '*';
  23. strcpy(out_s, not_found);
  24. break;
  25. }
  26. // what do I do if I didn't find the word?
  27. // might want another parameter or return value what
  28. // indicates that the word wasn't found
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment