Im having some difficulty with the following struct C progra

I\'m having some difficulty with the following struct C program requirement, help would be appreciated:

Write a program to keep records of books for a library. Create a structure BOOK and the information of each book contains ID, Name, Availability, Check-out date, Return Date. Store the following information in the using structure and display it on the screen.

Solution

   #include<stdio.h>

   struct Book
   {
       int id;
       char* name;
       int availability;
       char* checkoutdate;
       char* returndate;
      
   };


   int main()
   {
       struct Book b;

       b.id=241;
       b.name=\"C programming\";
       b.availability=0;
       b.checkoutdate=\"08/22/2016\";
       b.returndate=\"14/12/2016\";

       printf(\"B-id Name availability checkout date return date\ \");
       printf(\"%d\\t%s\\t%d\\t%s\\t%s\ \",b.id,b.name,b.availability,b.checkoutdate,b.returndate);
   }

====================================================================

/a.out

B-id Name availability checkout date return date
241   C programming   0   08/22/2016   14/12/2016

I\'m having some difficulty with the following struct C program requirement, help would be appreciated: Write a program to keep records of books for a library.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site