Answered step by step
Verified Expert Solution
Link Copied!

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 1. Write a file called
class Entry {
private:
std::string word;
int counter;
public:
Entry(const 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 2. 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 1
. By 1, 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 2, the function prints counter and "pizza" contains the word
pizza 2
which defines the following class: dictionary.h 3. Write a file called
class Dictionary {
private:
std::list values;
public:
Dictionary();
~Dictionary();
void insert(const std::string& input);
void print();
};
. dictionary.h which defines the functions declared in dictionary.cpp 4. 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 1 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
{pizza,3},{aardvark,2},{intergalactic,3},{zoology,2}
So the function will print like this:
aardvark 2
zoology 2
intergalactic 3
pizza 3
that builds a dictionary, puts some values into it, and prints the dictionary. You can insert main.cpp 5. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

What market risk is? AppendixLO1

Answered: 1 week ago