Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program in C: The user of your program will use it to create a list of books they have read, and then your program will

Program in C:

The user of your program will use it to create a list of books they have read, and then your program will create a subset of this list as a favorites list. You will not know how many books the user wishes to include on the list until the program gets its first input. After the user has finished entering all of the books titles, you must prompt the user for a subset of the book titles to put on a favorites list. You must use pointers within this project such that you have one array of char * that contains all of the book titles, one array of char ** that contains the list of the book titles and an array of char *** for favorites. The third item this program does is ask the user whether or not they want to store a copy of their information in a file on disk. If so, you program will ask for a file name and store the information within the file in the format shown in the example below.

The program should first, prompt the user to enter the number of books titles they plan to enter. Then, you must dynamically allocate enough memory to hold all books titles. You can assume that there will be no book titles with more than 60 characters. Remember that all character strings in C are null terminated and that you have to allocate space in your string for that null character, in addition to the length of the string you wish to have. Also realize that you wont know how many of the 60 characters the book title will fill until after you read the title. You should then prompt the user to enter each book title on a separate line. You must assume that each book title could contain more than one word and will be separated by a newline character from the next book title. You can assume that the user will enter the input in this format, so you do not need to check to make sure that the format of the input meets this description, and you do not need to reject input which is not properly formatted.

After reading in all of the book titles, your program should print all of the book titles back out. Then ask user to pick how many books they wish to put on their favorites list. The favorites list will consist of a subset (up through all books on the titles list) of the books on the titles list. Once you have this number, you will have to dynamically allocate enough space for an array of 8-byte addresses. The user will then specify by title number which books should be included on the favorites list. The program should then print out the books on the favorite list. Next, the program should ask whether or not the user wishes to store in an ASCII file the information they have input. They indicate yes/no with 1 or 2. If the user wishes to save the data, you must open a file and store the information in the file based on the format shown below, close the file, and then confirm to the user the data has been saved. Prior to exiting the program, you must free() all dynamically allocated memory.

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

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions