Question: You were given two text files with comma separated values: books.txt, which is a list of books and their authors, and ratings.txt, which is a
You were given two text files with comma separated values: books.txt, which is a list of books and their authors, and ratings.txt, which is a list of users and their ratings of those books.
Write a function getUserReadCount for determining how many books a particular user has read and reviewed. This function should:
Accept five arguments in this order: string: username for whom we want a read count string array: all users 2D int array: list of all ratings, one row for each user int: number of users in the arrays int: number of books accounted for in the 2D array
Return the number of books read/reviewed by the specified user, as an integer.
int getUserReadCount(string username, string allUsers[], int ratings[][50], int users, int counts){ }
If the program has not read ratings.txt or books.txt, it must read it first before executing this function. In this case, return -1 after printing the following message: cout << name << " does not exist in the database" << endl;
If instead the database is initialized but the user is not found, return -1 after printing the following message : cout << name << " does not exist in the database" << endl;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
