TABLE OF CONTENTS
Acknowledgement
Header files and their purpose
Coding
Motive
Requirements
Screen Shots of execution
Bibliography
Limitations
Certificate
ACKNOWLEDGEMENT
I thank my Computer Science teacher Mr. Abhisek
Roy for guidance and support. I am also thankful to
our Principal Mrs. Moitreyee Mukherjee. I would
also like to thank my parents for encouraging me
during the course of this project. Finally I would like
to thank CBSE for giving me this opportunity to
undertake this project.
HEADER FILES USED AND
THEIR PURPOSES
#include<fstream.h> -- for file handling, cin and
cout
#include<iomanip.h>--for manipulating the output
#include<conio.h>-- for clrscr() and getch() functions
#include<stdio.h>-- for standard I/O operations
#include<string.h>-- for string copy and comparison.
#include<process.h>-- for terminating the program.
PROGRAM CODE
//.........CBSE COMPUTER SCIENCE PROJECT........
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
#include<iomanip.h>
class book
char bno[6];
char book_name[50];
char author_name[20];
public:
void create_book()
cout<<"\nNEW BOOK ENTRY...\n";
cout<<"\nEnter The book no.";
cin>>bno;
cout<<"\n\nEnter The Name of The Book ";
gets(book_name);
cout<<"\n\nEnter The Author's Name ";
gets(author_name);
cout<<"\n\n\nBook Created..";
void show_book()
{
cout<<"\nBook no. : "<<bno;
cout<<"\nBook Name : ";
puts(book_name);
cout<<"Author Name : ";
puts(author_name);
void modify_book()
cout<<"\nBook no. : "<<bno;
cout<<"\nModify Book Name : ";
gets(book_name);
cout<<"\nModify Author's Name of Book : ";
gets(author_name);
char* retbno()
return bno;
void report()
{ cout<<bno<<setw(30)<<book_name<<setw(30)<<author_name<<endl;}
} bk; //class ends here
class student
char admno[6];
char name[20];
char stbno[6]; //No. of the book issued
int token; //To check if had return the last book
public:
void create_student()
clrscr();
cout<<"\nNEW STUDENT ENTRY...\n";
cout<<"\nEnter The admission no. ";
cin>>admno;
cout<<"\n\nEnter The Name of The Student ";
gets(name);
token=0;
stbno[0]='/0';
cout<<"\n\nStudent Record Created..";
void show_student()
cout<<"\nAdmission no. : "<<admno;
cout<<"\nStudent Name : ";
puts(name);
cout<<"\nDoes have a Book issued : ";
if(token==1)
cout<<"YES"<<"\nBook No. "<<stbno;
else
cout<<"No";
void modify_student()
cout<<"\nAdmission no. : "<<admno;
cout<<"\nModify Student Name : ";
gets(name);
char* retadmno()
return admno;
char* retstbno()
return stbno;
int rettoken()
return token;
void addtoken()
{ token=1;}
void resettoken()
{ token=0; }
void getstbno(char t[])
strcpy(stbno,t);
void report()
{ cout<<"\t"<<admno<<setw(20)<<name<<setw(10)<<token<<endl;}
}st; //class ends here
fstream f,f1; //Global declaration of the file streams
void write_book()
char ch;
f.open("book.dat",ios::binary|ios::app);
do
clrscr();
bk.create_book();
f.write((char*)&bk,sizeof(book));
cout<<"\n\nDo you want to add more record..(y/n?)";
cin>>ch;
} while(ch=='y'||ch=='Y');
f.close();
void write_student()
char ch;
f.open("student.dat",ios::out|ios::app);
do
st.create_student();
f.write((char*)&st,sizeof(student));
cout<<"\n\ndo you want to add more record..(y/n?)";
cin>>ch;
} while(ch=='y'||ch=='Y');
f.close();
void disp_spec_book(char n[])
cout<<"\nBOOK DETAILS\n";
int flag=0;
f.open("book.dat",ios::in);
while(f.read((char*)&bk,sizeof(book)))
if(strcmp(bk.retbno(),n)==0)
bk.show_book();
flag=1;
f.close();
if(flag==0)
cout<<"\n\nBook does not exist";
getch();
void disp_spec_stud(char n[])
cout<<"\nSTUDENT DETAILS\n";
int flag=0;
f.open("student.dat",ios::in);
while(f.read((char*)&st,sizeof(student)))
{
if((strcmp(st.retadmno(),n)==0))
st.show_student();
flag=1;
f.close();
if(flag==0)
cout<<"\n\nStudent does not exist";
getch();
void modify_book()
char n[6];
int found=0;
clrscr();
cout<<"\n\n\tMODIFY BOOK REOCORD.... ";
cout<<"\n\n\tEnter The book no. of The book";
cin>>n;
f.open("book.dat",ios::in|ios::out);
(f.read((char*)&bk,sizeof(book)) && found==0)
if(strcmp(bk.retbno(),n)==0)
bk.show_book();
cout<<"\nEnter The New Details of book"<<endl;
bk.modify_book();
f.seekp((-1*sizeof(bk)),ios::cur);
f.write((char*)&bk,sizeof(book));
cout<<"\n\n\t Record Updated";
found=1;
f.close();
if(found==0)
cout<<"\n\n Record Not Found ";
getch();
void modify_student()
char n[6];
int found=0;
clrscr();
cout<<"\n\n\tMODIFY STUDENT RECORD... ";
cout<<"\n\n\tEnter The admission no. of The student";
cin>>n;
f.open("student.dat",ios::in|ios::out);
while(f.read((char*)&st,sizeof(student)) && found==0)
if(strcmp(st.retadmno(),n)==0)
st.show_student();
cout<<"\nEnter The New Details of student"<<endl;
st.modify_student();
f.seekp((-1*sizeof(st)),ios::cur);
f.write((char*)&st,sizeof(student));
cout<<"\n\n\t Record Updated";
found=1;
f.close();
if(found==0)
cout<<"\n\n Record Not Found ";
getch();
void delete_student()
char n[6];
int flag=0;
clrscr();
cout<<"\n\n\n\tDELETE STUDENT...";
cout<<"\n\nEnter The admission no. of the Student You Want To Delete : ";
cin>>n;
f.open("student.dat",ios::in|ios::binary);
fstream f2;
f2.open("Temp.dat",ios::out|ios::binary);
f.seekg(0,ios::beg);
while(f.read((char*)&st,sizeof(student)))
if(strcmp(st.retadmno(),n)!=0)
f2.write((char*)&st,sizeof(student));
else
flag=1; }
f2.close();
f.close();
remove("student.dat");
rename("Temp.dat","student.dat");
if(flag==1)
cout<<"\n\n\tRecord Deleted ..";
else
cout<<"\n\nRecord not found";
getch();
void delete_book()
char n[6];
clrscr();
cout<<"\n\n\n\tDELETE BOOK ...";
cout<<"\n\nEnter The Book no. of the Book You Want To Delete : ";
cin>>n;
f.open("book.dat",ios::in|ios::binary);
fstream f2;
f2.open("Temp.dat",ios::out|ios::binary);
f.seekg(0,ios::beg);
while(f.read((char*)&bk,sizeof(book)))
if(strcmp(bk.retbno(),n)!=0)
f2.write((char*)&bk,sizeof(book));
}
f2.close();
f.close();
remove("book.dat");
rename("Temp.dat","book.dat");
cout<<"\n\n\tRecord Deleted ..";
getch();
void display_all_stud()
clrscr();
f.open("student.dat",ios::in);
if(!f)
cout<<"ERROR!!! FILE COULD NOT BE OPEN ";
getch();
return;
cout<<"\n\n\t\t S T U D E N T L I S T\n\n";
cout<<"------------------------------------------------------------------\n";
cout<<"\tAdmission No."<<setw(10)<<"Name"<<setw(20)<<"Does Book Issued\n";
cout<<"------------------------------------------------------------------\n";
while(f.read((char*)&st,sizeof(student)))
st.report();
f.close();
getch();
void display_allb()
clrscr();
f.open("book.dat",ios::in);
if(!f)
cout<<"ERROR!!! FILE COULD NOT BE OPEN ";
getch();
return;
cout<<"\n\n\t\tBOOK LIST\n\n";
cout<<"------------------------------------------------------------------\n";
cout<<"Book Number"<<setw(20)<<"Book Name"<<setw(25)<<"Author\n";
cout<<"------------------------------------------------------------------\n";
while(f.read((char*)&bk,sizeof(book)))
bk.report();
f.close();
getch();
void book_issue()
char sn[6],bn[6];
int found=0,flag=0;
clrscr();
cout<<"\n\nBOOK ISSUE ...";
cout<<"\n\n\tEnter The student's admission no.";
cin>>sn;
f.open("student.dat",ios::in|ios::out|ios::binary);
f1.open("book.dat",ios::in|ios::out|ios::binary);
while(f.read((char*)&st,sizeof(student)) && found==0)
if(strcmp(st.retadmno(),sn)==0)
found=1;
if(st.rettoken()==0)
cout<<"\n\n\tEnter the book no. ";
cin>>bn;
while(f1.read((char*)&bk,sizeof(book))&& flag==0)
if(strcmp(bk.retbno(),bn)==0)
bk.show_book();
flag=1;
st.addtoken();
st.getstbno(bk.retbno());
int pos=-1*sizeof(st);
f.seekp(pos,ios::cur);
f.write((char*)&st,sizeof(student));
cout<<"\n\n\t Book issued successfully\n";
if(flag==0)
cout<<"Book no. does not exist";
}
else
cout<<"You have not returned the last book ";
if(found==0)
cout<<"Student record not exist...";
getch();
f.close();
f1.close();
void book_deposit()
char sn[6],bn[6];
int found=0,flag=0,day,fine;
clrscr();
cout<<"\n\nBOOK DEPOSIT ...";
cout<<"\n\n\tEnter The student’s admission no.";
cin>>sn;
f.open("student.dat",ios::in|ios::out|ios::binary);
f1.open("book.dat",ios::in|ios::out|ios::binary);
while(f.read((char*)&st,sizeof(student)) && found==0)
if(strcmp(st.retadmno(),sn)==0)
found=1;
if(st.rettoken()==1)
while(f1.read((char*)&bk,sizeof(book))&& flag==0)
{
if(strcmp(bk.retbno(),st.retstbno())==0)
bk.show_book();
flag=1;
cout<<"\n\nBook deposited in no. of days";
cin>>day;
if(day>15)
fine=(day-15)*1;
cout<<"\n Sorry!!! Fine has to be deposited of Rs. "<<fine;
st.resettoken();
int pos=-1*sizeof(st);
f.seekp(pos,ios::cur);
f.write((char*)&st,sizeof(student));
cout<<"\n\n\t Book deposited successfully";
if(flag==0)
cout<<"Book no does not exist";
else
cout<<"No book is issued..please check!!";
if(found==0)
cout<<"Student record not exist...";
getch();
f.close();
f1.close(); }
void intro()
cout<<"=========================================================\n";
cout<<" CBSE COMPUTER SCIENCE PROJECT \n";
cout<<"=========================================================\n";
cout<<" 2017-2018 \n\n\n";
cout<<" LIBRARY MANAGEMENT \n\n";
cout<<" -By Abhisek Roy\n";
getch();
void librarian_menu()
clrscr();
int ch2;
cout<<"\t -------------- \n";
cout<<"\n\n\t LIBRARIAN MENU";
cout<<"\t -------------- \n";
cout<<"\n\t 1. CREATE STUDENT RECORD";
cout<<"\n\t 2. DISPLAY ALL STUDENTS RECORD";
cout<<"\n\t 3. DISPLAY SPECIFIC STUDENT RECORD ";
cout<<"\n\t 4. MODIFY STUDENT RECORD";
cout<<"\n\t 5. DELETE STUDENT RECORD";
cout<<"\n\t 6. CREATE BOOK RECORD";
cout<<"\n\t 7. DISPLAY ALL BOOKS ";
cout<<"\n\t 8. DISPLAY SPECIFIC BOOK ";
cout<<"\n\t 9. MODIFY BOOK RECORD";
cout<<"\n\t 10. DELETE BOOK RECORD";
cout<<"\n\t 11. BACK TO MAIN MENU";
cout<<"\n\tPlease Enter Your Choice (1-11) ";
cin>>ch2;
switch(ch2)
case 1: clrscr();
write_student();break;
case 2: display_all_stud();break;
case 3:
char num[6];
clrscr();
cout<<"\n\n\tPlease Enter The Admission No. ";
cin>>num;
disp_spec_stud(num);
break;
case 4: modify_student();break;
case 5: delete_student();break;
case 6: clrscr();
write_book();break;
case 7: display_allb();break;
case 8: {
char num[6];
clrscr();
cout<<"\n\n\tPlease Enter The book No. ";
cin>>num;
disp_spec_book(num);
break;
case 9: modify_book();break;
case 10: delete_book();break;
case 11: return;
default: cout<<"\a";
librarian_menu();
void main()
char ch;
intro();
do
clrscr();
cout<<"\n\t MAIN MENU \n";
cout<<"\n\t01. BOOK ISSUE";
cout<<"\n\t02. BOOK DEPOSIT";
cout<<"\n\t03. LIBRARIAN MENU";
cout<<"\n\t04. EXIT";
cout<<"\n\tPlease Select Your Option (1-4) ";
ch=getche();
switch(ch)
case '1':clrscr();
book_issue();
break;
case '2':book_deposit();
break;
case '3':librarian_menu();
break;
case '4':exit(0);
default :cout<<"\a";
} while(ch!='4');
}
MOTIVE
TO PROVIDE AN EFFICIENT AND RELIABLE WAY TO
AUTOMATE A LIBRARY
TO ISSUE AND DEPOSIT BOOKS ALSO MAINTAING AN
ACCOUNT FOR THE LIBRARIAN
GLOBALIZED USAGE.
DECREASE REDUNDANCY.
REQUIREMENTS
HARDWARE REQUIRED
Printer, to print the required documents of the project
Compact Drive
Processor : Pentium III and above
Ram : 64 MB (minimum)
Hard-disk : 20 GB(minimum).
SOFTWARE REQUIRED
Operating system : Windows XP,7,8,10
Turbo C++/Borland C++ for execution of program
MS-Word, for presentation of output.
www.cbseportal.com
SCREEN SHOTS OF
EXECUTION
MAIN MENU
CREATING STUDENT
NEW BOOK ENTRY
BOOK ISSUE
BOOK DEPOSIT
BOOK SEARCH
BIBLIOGRAPHY
COMPUTER SCIENCE IN C++ by SUMITA ARORA
www.cplusplus.com
www.ICBSE.com
www.programmingisaddictive.com
LIMITATIONS
Monetary penalties for tearing book pages and others
are not included in the project.
Searching the location of the books is not possible
through this Project.
The project does not incorporate reading of e-Books.
Certificate
This is to certify that of class 12, Army Public
School, Barrackpore has successfully completed his project in
computer practical for the AISSCE as prescribed by CBSE in the
year 2018-2019.
Date :
Roll No :
Signature of Internal Signature of External
Examiner Examiner
__________________ __________________