Computers and Technology

We will now update the readratings from homework 5 to use an array of user objects instead of having a usernames array and a ratings array. the functionality stays the same as the one from homework 5. write a function readratings that loads the user ratings by reading the ratings. txt file. the first value of each line in ratings. txt is the username. each username is followed by a list of ratings of the user for each book in books. txt. for example, let us say there are in total of 3 books. the ratings. txt file would be of the format: ritchie,3,3,3 stroustrup,0,4,5 gosling,2,2,3 rossum,5,5,5 this function should: accept five parameters in this order: β—‹ string filename: the name of the file to be read β—‹ array users: array of user objects β—‹ int numusersstored number of users currently stored in the arrays β—‹ int usersarrsize: capacity of the users arrays. the default value for this data member is 100. β—‹ int maxcol: maximum number of columns. the default value for this data member is 50. use ifstream and getline to read data from the file, making an instance of a user object for each line, and placing it in the users array. hint: you can use the split() - function from homework 4, with comma (",") as the delimiter. when you copy your code in the answer box on moodle coderunner, make sure you copy users class, readbooks() function, and split() function. you can use stoi to convert each rating value (a string, as read from the text file) into an integer value. empty lines should not be added to the arrays. the function should return the following values depending on cases: β—‹ case1: when numusersstored is greater than or equal to the usersarrsize, return -2. β—‹ case2: if the file cannot be opened, return -1. β—‹ case3: when numusersstored is smaller than the size of users array, keep the existing elements in users array, then read data from file and add (append) the data to the arrays. the number of users stored in the arrays cannot exceed the size of the users array. β—‹ case4: return the total number of users in the system, as an integer. β—‹ your function must check these cases in the order specified above. example 1: the users array is empty, so numusersstored is 0. ratings. txt ninja,0,1,2,3,4 myth,2,2,4,5,1 sphyer,3,1,0,0,5 daequan,0,0,0,0,2 function call user users[10]; int numusers = 0; int usersarrsize = 10; readratings("ratings. txt", users, numusersstored, usersarrsize, 50); return value 4 testing the data member username // code to print the values cout

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:30, raiapowell
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
image
Computers and Technology, 23.06.2019 06:20, Ab20600
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
image
Computers and Technology, 23.06.2019 16:00, keyonaemanieevans
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, bubbles173883
While inserting images, the picture command is usually used to insert photos from a digital camera, and the clip art command is usually used to a. edit the sizes and other characteristics of photos that have been inserted. b. take a screenshot of an image and copy it to the clipboard for pasting. c. search for drawings or other images from a library of prepared pictures. d. make illustrations using lines and shapes that are easy to manipulate.
Answers: 1
Do you know the correct answer?
We will now update the readratings from homework 5 to use an array of user objects instead of having...

Questions in other subjects:

Konu
Mathematics, 22.04.2021 22:20
Konu
Mathematics, 22.04.2021 22:20
Konu
Mathematics, 22.04.2021 22:20