Condition:

A foreign word card is a structure containing a foreign word and its translation. To simulate an electronic dictionary of foreign words, implement a Dictionary class. This class has a dictionary name field and contains an array of Wordcard structures representing foreign word cards.
The name of the dictionary is set when creating a new dictionary, but it should be possible to change it during operation. Cards are attached to the dictionary and removed from it.
Implement the search for a specific word as a separate method. The argument of the indexing operation must be a foreign word. The dictionary should not be duplicate cards.
Implement merge operations, intersections and dictionaries. When implemented, a new dictionary should be created, and output dictionaries should not be changed. When combined, the new dictionary should contain, without repetition, all the words contained in both operand vocabularies. At the intersection of a new dictionary should consist only of words that are in both dictionaries, operands. If there is a difference, the new dictionary should contain the words of the first operand dictionary, absent in the other.

How to bring to full working condition?
The code according to the condition is not slightly improved.

My source:

#include <iostream> #include <cstdio> #include <conio.h> using namespace std; struct WordCard { char word[100]; char trans; }; class Dictionary { public: char name[]; WordCard card[100]; friend istream &operator>>(istream &stream, Dictionary &ob); Dictionary(char); void greate(); void show(); void search(); Dictionary operator+(Dictionary ob); Dictionary operator-(Dictionary ob); Dictionary operator/(Dictionary ob); }; Dictionary::Dictionary(char n[]) { strcpy(this->name,n); } istream &operator>>(istream &stream, Dictionary &ob) { cout << "Enter the name of your new dictionary:"<<endl; stream >> ob.name; } void Dictionary::greate() { cout<<"Enter name of your new dictionary"<<endl; cin>>name; } void Dictionary::show() { cout<<"Your Dictionaries:"<<endl; cout<<name<<":"<<endl; } void Dictionary::search() { } int main() { char ch; Dictionary d("First"); Dictionary a("Second"); Dictionary b("Third"); for(;;) { cout<<"Menu:\n"; cout<<"1.Greate new dictionary\n"; cout<<"2.Show dictionaries\n"; cout<<"3.Exit\n"; cout<<"Your choise: "; cin>>ch; switch(ch) { case '1':a.greate();break; case '2':a.show(); break; case '3':exit(0); } } return 0; } 
  • 2
    @ lixod96, did you boast your code or did you have a specific question? - fori1ton
  • @ lixod96, give a definition of "full working condition"? - Arkady
  • Amazing code. I am afraid that you, thus, will bring down the market of software products. - BuilderC

2 answers 2

@ lixod96 ,

The code according to the condition is not slightly modified, can you add it?

We can. But we will not. According to the rules of the forum, the questions should not be reduced to the decision or the completion of educational tasks for students. In addition, the code is not “slightly modified”, the largest and most difficult part of it is missing, and the one that has already been done is so elementary that it cannot be considered any significant independent work. If you have specific questions on the implementation of the necessary functionality - please ask. But do not ask to do your work for you.

    @ lixod96 , if you are not required to self-implement the "low-level" algorithms, you can take as a basis

    http://www.cplusplus.com/reference/map/map and implement the add-in.

    Otherwise, try to read, for example, with this.

    http://web.mit.edu/~emin/www.old/source_code/red_black_tree/index.html code.