Question
Please add the following to the code: 1) Check the command line arguments. A file is specified as -f textfile. If a file has not
Please add the following to the code:
1) Check the command line arguments. A file is specified as "-f textfile". If a file has not been specified, exit the program with a meaningful error message.
2) Open the input file specified by argv[2] and enter into an endless loop that reads and processes the text lines. Save each text line in a cache (e.g., vector
3) Add a second endless loop that prompts the user for words to search for. Print all line numbers and the corresponding text for each successfull search. Print nothing for an unsuccessfull search. Use the vector of line numbers returned by hash_table::find() to do this. Look up the text in the above mentioned data cache for each line number. See output examples below.
4) Make no assumptions about the number of lines in the input file. Make no assumptions about the number of characters or words on each line. The test files may be pure ascii text, html code, or even a C++ program. Your code should work regardless of the type of ascii data stored in the file.
Given Code:
#include <...> using namespace std; typedef unsigned int uint; template
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