Using the knowledge in computational language in C it is possible to write a code that uses a class called "books". Data members of this class are author, title, price, publisher and stock position.
<h3>Writting the code in C++</h3>
<em>#include<iostream.h></em>
<em>#include<conio.h></em>
<em>#include<stdio.h></em>
<em>#include<string.h></em>
<em />
<em>//declaration of class books</em>
<em>class books</em>
<em>{</em>
<em />
<em>//data members of books class</em>
<em>public:</em>
<em>char author[20];</em>
<em>char title[20];</em>
<em>char publisher[50];</em>
<em>int price;</em>
<em>int copies;</em>
<em>int stock;</em>
<em />
<em>//setData() function to set data of books</em>
<em>void setData()</em>
<em>{</em>
<em>cout<<"\nEnter the following details:\nAuthor's Name:";</em>
<em>gets(author);</em>
<em>cout<<"\nTitle :";</em>
<em>gets(title);</em>
<em>cout<<"\nPublisher :";</em>
<em>gets(publisher);</em>
<em>cout<<"\nPrice :";</em>
<em>cin>>price;</em>
<em>cout<<"\nNumber of copies:";</em>
<em>cin>>copies;</em>
<em>stock=1;</em>
<em>}</em>
<em />
<em>//check() function to check if a book is available or not</em>
<em>void check()</em>
<em>{</em>
<em>char t[20],aut[20];</em>
<em>int cop;</em>
<em>cout<<"\nEnter the following details to search for book:\n";</em>
<em>cout<<"\nTitle of the book:";</em>
<em>gets(t);</em>
<em>cout<<"\nEnter Author's Name :";</em>
<em>gets(aut);</em>
<em>cout<<"\nNumber of copies:";</em>
<em>cin>>cop;</em>
<em>if(strcmp(t,title) & strcmp(aut,author) & (cop<=copies))</em>
<em>{</em>
<em>cout<<"\nBook is availabe in store\nPrice = "<<cop*price;</em>
<em>copies-=cop;</em>
<em>}</em>
<em>else</em>
<em>{</em>
<em>cout<<"Not available";</em>
<em>}</em>
<em>}</em>
<em>};</em>
<em />
<em />
<em>void main()</em>
<em>{</em>
<em>clrscr();</em>
<em>books bk;</em>
<em>bk.setData();</em>
<em>bk.check();</em>
<em>getch();</em>
<em>}</em>
See more about C code at brainly.com/question/17544466
#SPJ1