Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ and Search.cpp Please. Summary: searching text files for (key, value) pairs, e.g. movies and their total revenue Google collects all sorts of interesting
In C++ and Search.cpp Please.
Summary: searching text files for (key, value) pairs, e.g. movies and their total revenue Google collects all sorts of interesting data: what words appear most frequently in searches? What web sites are most commonly searched using Alexa? What are the most popular baby names? For example, the data file "words-by-freq.txt ranks the English words used most commonly in searches. Here's the start of the file 5627187200 the 3395006400 of 2994418400 and 2595609600 to The words are listed by rank, so "the" is the most frequently searched word with a frequency of "5627187200". The 2nd most frequently searched word is 'of, with a frequency of "3395006400", and so on. The file ends with # and # In general, we call this type of file a "(key, value) file, since the data comes in pairs, and the "key" uniquely identifies the 'value". Note that the value is on the left, and the key is on the right. This implies you should view these types of files like this: value key value key value key Note that you should view the values and keys as stringsoften the values are integers and the keys are strings, but it's dangerous to assume this is always true. Instead, treat all input data as strings, and use string variables In this exercise, you're going to write a complete C++ program that searches data from a (key, value) input file, outputting some statistics values, and ranks. The main0 program is written for you (and cannot be modified); your job is to implement the 2 functions in search.cpp that do the work of opening, inputting, and searching the input file. First, here's an example input sequence for the program: words-by-freq.txt headache the meanwhile The first input is the filename, and the remaining inputs are keys to search for. The keys are followed by #, which stops the program. Here's the correct output given this input sequenceStep 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