Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C + + Content of the exercise: In the exercise you will implement a special kind of dictionary. Words are saved in this dictionary, and
C
Content of the exercise: In the exercise you will implement a special kind of dictionary. Words are saved in this dictionary, and next to each word is saved a counter that counts
How many times users entered the word in the dictionary. When the dictionary is printed, the words are printed in order of frequency of use
In them, that is: according to the number of times they were entered into the dictionary.
Shamagadi sees the following class: entry.h Write a file called
class Entry
private:
std::string word;
int counter;
public:
Entryconst std::string& input;
~Entry;
void increment;
void print;
;
It is allowed to declare additional functions and variables inside and outside the class, according to the requirements of your solution for the exercises.
This is also true in the following questions.
entry.h which defines the functions declared in entry.cpp Write a file named
counter of the classifier, and initializes the word member to the input member. The class constructor copies the contents of the parameter
with the value
By the counter advances the value of the increment function
word prints the department fields in one line with a line break at the end For example, if the print function
Contains the number the function prints counter and "pizza" contains the word
pizza
which defines the following class: dictionary.h Write a file called
class Dictionary
private:
std::list values;
public:
Dictionary;
~Dictionary;
void insertconst std::string& input;
void print;
;
dictionary.h which defines the functions declared in dictionary.cpp Write a file named
is already roughly in the dictionary. If it is not found, it creates an input and checks if the word insert is the function
of the same value is advanced by counter if the word is found, the member Entry new value in the dictionary of type
Prints the dictionary. The dictionary should be printed so that it is sorted in ascending order of the counter. The print function
Entries with the same counter will be sorted, in a secondary sort, in alphabetical order. For example, if the dictionary contains the values
pizzaaardvarkintergalacticzoology
So the function will print like this:
aardvark
zoology
intergalactic
pizza
that builds a dictionary, puts some values into it and prints the dictionary. You can insert main.cpp Write a file called
values and print as many as you want. This file can be used by you to test your software. Do not submit only the other files defined above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started