davemx_5

Untitled

May 16th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 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. cout << 1 << endl;
  9. }
  10.  
  11. if(i<numEntries)
  12. {
  13. strcpy(out_s, elvishWord[i]);
  14. cout << 2 << endl;
  15. }
  16.  
  17. else{
  18. string not_found;
  19. cout << 3 << endl;
  20. not_found = '*' + s + '*';
  21. cout << 4 << endl;
  22. strcpy(out_s, not_found.c_str());
  23. cout << 5 << endl;
  24. break;
  25.  
  26. }
  27. // what do I do if I didn't find the word?
  28. // might want another parameter or return value what
  29. // indicates that the word wasn't found
  30. }
Advertisement
Add Comment
Please, Sign In to add comment