Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ - I sent additional code in the next request as I couldn't post all the code. Is there a way to send a file

C++ - I sent additional code in the next request as I couldn't post all the code. Is there a way to send a file over?

Need in creating a function that adds a new user to the database.

The member function addUser adds a new user to the database. This function should: Accept one argument: string: user name Fill in the username and ratings data members for a User object, at the appropriate index in the array of User objects. : Update the total number of users in the system(from all the files read so far, see the Important note below) The name of the user is case insensitive (e.g. Ben. BEN, ben are all same as ben) Return True if the user is successfully added. If the user already exists in the database, print the following message and return False already exists in the database

If the database is full (the array of User objects is full), print the following message and return False Database full

Code

int main(int argc, char const *argv[]) { Library books; //varialbe for creating a book of ojects for the library Library users; //varialbe for creating a book of ojects for the library Library lib;

int numBooks = 0; //variable for tracking the number of books read int numUsers = 0; //variable for tracking the number users reading books string choice; //variable for the menu options and case statement string xbkfile; //variable for reading the book files string xrtfile; //variable for reading the ratings files string nameofuser = ""; //variable for storing the user name entered int booksRead = 0; //variable for storing the number of books read by user string viewuser = ""; //variable for storing the user name entered string selectbook = ""; double avgcalc = 0;

xbkfile = ""; //initalize book name files xrtfile = ""; //initialize ratings name file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

Students also viewed these Databases questions