Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. (30%) Create a program that allows the user to create a database of users. Each user will have a database ID, user ID, name,

image text in transcribed

3. (30%) Create a program that allows the user to create a database of users. Each user will have a database ID, user ID, name, and age. (a) The maximum user count for the database is 128. (b) The maximum name is 64 characters in length. The names should be null terminated (strings). (c) The user ID is the index of the array. (d) Use a 2D array to store the names. (e) Use a 1D array to store the ages. (f) Note that the database ID is simply the index in the array associated with the user. (g) Create a function add_user to add a new user to the database. If the user is successfully added, return 0. If the database is full, this function should return 1 and notify the user. The output notification should not come from the function itself! (h) Create a function list_users which lists all users in the database. This should only display users that have been added. The name, user ID, and age should be printed in the list. (i) Create a function get_user which looks up a user based on the user ID. It should return the database ID on success and -1 if the user does not exist. Print the name and age of the user from the calling function. 6) Create a function find_user which accepts a string as input and searches the database for a user matching that name. The function should return the database ID if the user is located, otherwise -1. (k) Don't forget to include array sizes in your functions. (1) Your code should be properly formatted to reflect the scope of each statement. (m) Save the code as user_store.c

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions