Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Write a function called BuildDatabase that reads a .txt file line by line using getline. Then you will need to break the line into
C++
Write a function called BuildDatabase that reads a .txt file line by line using getline. Then you will need to break the line into the score and the words. You may find an istringstream object helpful for this.
bool BuildDatabase(const string& fileName, int capacity, string words[], int counts[], int scores[], int& size) { assert(false); return false;
txt file below:
1 A series of escapades demonstrating the adage that what is good for the goose is also good for the gander , some of which occasionally amuses but none of which amounts to much of a story . 4 This quiet , introspective and entertaining independent is worth seeking . 1 Even fans of Ismail Merchant 's work , I suspect , would have a hard time sitting through this one .
When the program opens the file, it reads it line by line. First it reads the numerical rating (score) and then in breaks the rest of the line into words.
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