Write a menu driven program in C++ to perform the following functions on a binary file “BOOK.DAT” containing objects of the following class: class Book { int BookNo; char Book_name[20]; public: // function to enter book details void enterdetails(); //function to display Book details void showdetails(); //function to return Book_no int Rbook_no() {return Book_no;} //function to return Book_name int Rbook_name() {return Book_name;} }; 1. Append Records 2. Modify a record for a given book no. 3. Delete a record with a given book no. 4. Search for a record with a given Book name 5. Display a sorted list of records (sort on Book No.) 6. Display a sorted list of records (Sort on Book Name)
Answers
Write a menu driven program in C++ to perform the following functions on a binary file “BOOK.DAT” containing objects of the following class:
class Book
{ int BookNo;
char Book_name[20];
public:
// function to enter book details
void enterdetails();
//function to display Book details
void showdetails();
//function to return Book_no
int Rbook_no() {return Book_no;}
//function to return Book_name
int Rbook_name() {return Book_name;}
};
1. Append Records
2. Modify a record for a given book no.
(Use seekg(), tellg() for this purpose)
3. Delete a record with a given book no.
4. Search for a record with a given Book name
5. Display a sorted list of records (sort on Book No.)
6. Display a sorted list of records (Sort on Book Name)
Note: (i) Use dynamic array for sorting of the file.
(ii) Use gotoxy() to display the formatted reports.
(iii) The program should be password protected.
Dear customer,
Unfortunately, your question requires a lot of work and cannot be done for free.
Please submit it with all requirements as an assignment to our control panel and
we'll assist you.