Question

Implement a C++ program to develop a simple Library. Library contains pile of books and each...

Implement a C++ program to develop a simple Library. Library contains pile of books and each book comprises of ISBN (cannot be changed), Name, Author Name, Publisher Name, Issue Date, Return Date. [using Structures]

Homework Answers

Answer #1

In C++ a structure is a collection of different data type variables refered under a single name. it is very much similar to a class but it cannot hold the associated functions of the elements/data members in the block so given next to this explaination of structures is the code asked in the question.so its a very basic library system in which you can add a book by using insert function.

#include<iostream.h>
#include<conio.h>

struct book{
   char name[50];
   int ISBN;
   char authorname[50];
   char publishername[50];
   int issuedate;
   int issuemonth;
   int issueyear;
   int retdate;
   int retmonth;
   int retyear;
   struct book *next=NULL;
}

void insert(struct book *head){
    if *head.next==NULL{
       struct book node;
       cout<<"enter the name of book";
 
       gets(node.name)
       cout<<"enter the author name of book";
       gets(node.authorname)
       cout<<"enter the publisher name of book";
       gets(node.publishername)
       cout<<"enter isbn no.";
       cin>>node.ISBN;
       cout<<"enter the issue date month and year";
       cin>>node.issuedate;
       cin>>node.issuemonth;
       cin>>node.issueyear;
       cout<<"enter the return date month and year";
       cin>>node.retdate;
       cin>>node.retmonth;
       cin>>node.retyear;
       *head.next=&node;
    }
   else{
       insert(*head.next);
}
}
void main(){

//the pile of the books will be stored in a linked list where ISBN no. can be a searching key 
struct book library;//first book in library

insert(library);//inserting a book in library
insert(library);//inserting a book in library
getch();
}

*this code may or may not contain bugs.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using node.js create a system that includes a "library" of books and information about the books,...
Using node.js create a system that includes a "library" of books and information about the books, such as title, a description, author, publisher, ISBN. Include, at least, 12 books in the "library". Now create two people who like books and use the "Shared State" concept to demonstrate what each person's (you and another one) favorite book is. What to turn in: 1. All code and related files (as created via the IDE, so I can run it), compressed using zip....
Write a 4-6 sentence summary explaining how you can use STL templates to create real world...
Write a 4-6 sentence summary explaining how you can use STL templates to create real world applications. In your summary, provide an example of a software project that you can create using STL templates and provide a brief explanation of the STL templates you will use to create this project. After that you will implement the software project you described . Your application must be a unique project and must incorporate the use of an STL container and/or iterator and...
You have to create a Library Borrowing System based on the following requirements: When new books...
You have to create a Library Borrowing System based on the following requirements: When new books arrive, these books must be cataloged into the system by a librarian (i.e., entered in the system). Information on a book should include book ID, title, author ID, ISBN, and edition. The system should capture author names so that users can search for an author. The library may carry multiple books by the same author, and an author can have multiple books in the...
University library management system This case is a simplified (initial draft) of a new system for...
University library management system This case is a simplified (initial draft) of a new system for the University Library. Of course, the library system must keep track of books. Information is maintained about both book titles and the individual book copies. Book titles maintain information about title, author, publisher, and catalog number. Individual copies maintain copy number, edition, publication year, ISBN, book status (whether it is on the shelf or loaned out), and date due back in. The library also...
Need in Java coding Write a program that will allow users to enter different types of...
Need in Java coding Write a program that will allow users to enter different types of books into the program, and at the end print out everything that the user entered. Allow the user to enter as many books as they want. Please collect the following information and break down the classes as follows using inheritance/classes. I have added the extra properties that each class should include. Book types: Paper Book (nothing extra) Comic Book (issue number) Magazine (publisher, issue...
Given the following relations about students borrow books from a university library. Student (StudentID: integer, Name:...
Given the following relations about students borrow books from a university library. Student (StudentID: integer, Name: string, EnrollDate: date) Book(Title: string, Author: string, Quantity: integer) BorrowRecord(StudentID: integer, BookTitle: string, BookAuthor: string, BorrowDate: date, DueDate: date, Returned: integer) Note that there are no duplicate records in the three relations, and there can be duplicates of book titles. For Returned, 0 means not returned and 1 indicates the books have been returned. Write the following queries in SQL. (a) Find the StudentIDs...
Plot a UML diagram for the following application. A chain of community libraries run book loan...
Plot a UML diagram for the following application. A chain of community libraries run book loan services. A book can be borrowed from a library of the chain and returned to another library. A book has an ISBN number, a title, some authors, and a year of publication. Books have a loan period limit which is determined by how frequent the books have been borrowed. Books may have multiple copies and each copy has an item number. When all copies...
Use ONLY the classes in this list to draw a Class diagram. The diagram must show...
Use ONLY the classes in this list to draw a Class diagram. The diagram must show all the classes, their attributes, and the relationships between the classes. All the associations must have proper multiplicity constraints indicated. Note that class methods and attribute types are not required.                                                                                                               Domain classes and their attributes Order [date/time, total price, status] Account [full name, address, phone, email] SellerAccount (no attributes) BuyerAccount [credit card] Book [title, ISBN, author, publisher, asking price] BookOnOrder [quantity] Dispute [reason]...
Question 2 The questions in this section are all based on the “Online Book Exchange System...
Question 2 The questions in this section are all based on the “Online Book Exchange System (EyesHaveIt.com)” Case Study on the last page of this document. Read the case study carefully before answering these questions. b) An analyst has identified all the domain classes and their attributes required for the system, as listed below. Use ONLY the classes in this list to draw a Class diagram. The diagram must show all the classes, their attributes, and the relationships between the...
Your assignment is to implement a computer program in C++ to implement the below application. According...
Your assignment is to implement a computer program in C++ to implement the below application. According to Dummies.com the following algorithm determines the amount of paint you need to paint the walls of a four-sided room: 1. Add together the length of each wall. (For example, if each of the four walls are 14, 20, 14, 20 feet respectively then the total length is 14 + 20 + 14 + 20 = 68 feet) 2. Multiply the sum by the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT