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; }