Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!