Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void tr(Thesaurus& thes) {
- char* word = (char*)malloc(sizeof(char) * 256);
- printf("Enter the word you want to see translation for\n");
- (void)scanf("%s", word);
- word = (char*)realloc(word, sizeof(char) * (strlen(word) + 1));
- if (word[0] > 'A' && word[0] < 'z') {
- auto it = thes.eng.begin();
- for (it; it != thes.eng.end(); ++it) {
- if (strcmp((*it).word, word) == 0) {
- printf("%10s - %s\n", word, (*it).tr);
- break;
- }
- }
- if (it == thes.eng.end()) printf("No such word in Thesaurus.\n");
- }
- else {
- auto it = thes.rus.begin();
- for (it; it != thes.rus.end(); ++it) {
- if (strcmp((*it).word, word) == 0) {
- printf("%10s - %s\n", word, (*it).tr);
- break;
- }
- }
- if (it == thes.rus.end()) printf("No such word in Thesaurus.\n");
- }
- free(word);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement