Professional Documents
Culture Documents
PAPER
CSE-101
Submitted to:
Ms. SATINDAR KAUR ( Deptt. Of COMPUTER)
Submitted by:
Mr. Money Bansal Roll.No.- R205A06 Reg.No- 10802676 Class- B.Tech-(ECE)
INTRODUCTION
C is a programming language developed at AT &Ts bell laboratories of USA in 1972.It was deigned by Dennis Retchie. This project of LIBRARY MANAGEMENT SYSTEM gives us the complete information about the library.We can enter the record of new books and retrieve the details of books available in the library .We can issue the books to the student and maintain their records and can also check how many books are issued and stock available in the library. The library Management system is designed & developed for a receipt and issuance of books in the library along with the students details.The books received in the library are entered in books entry
form.When the student wants to get the desired books the same is issued on the availability basis to the student.
Advantages:-There are many advantages of this system whose name is Library management System This system process
made computerized to reduce human errors and to increase the efficiency.The main focus of this project is to lesson human efforts.The maintenance of the records is made efficient, as all the record are stored in the access database, through which data can be retrieved easily.
A database to store the details about the books should be designed. A unique id should be given for each books in the library. This will be the key of the database. These are follows--S. No. 1. Field Name Article Id Field Range Any valid 5 digit number Remarks This is the key field of the database. We can have some alpha numeric character in the beginning to show if the article is a book/journal. If a name exceeds 25 characters, the first 25 characters are taken. ___
2.
3.
4.
If a name exceeds 25 characters, the first 25 characters are taken. This is the publication year.
5. 6.
Up to 25 character Like mathematics, physics chemistry in length etc. Up to 15 character Id of the person who has currently in length borrowed it.
7.
Borrowers user Id
Source Code :
#include<stdio.h> #include<dos.h> #include<ctype.h> #include<stdlib.h> #include<string.h> #define nm 20 #define cal 2 #define idn 5 #define dt 2 void chk_name(char *p,int); void chk_id(char *p,int); int duplicate(char temp[]); int duplicatest(char temp[]); void studinfo(); void issue(); void returned(); void viewstfo(); void view1(); void stuissue(); struct lib { char bname[nm]; char bid[idn]; } lib1; struct isue { char sid[idn]; char bid[idn]; int isdate; int redate; } iss1; struct ret { char sid[idn]; char bid[idn];
int redate; } ret1; struct st { char sid[idn]; char sname[nm]; //struct lib lib2; //struct isue iss2; //struct ret ret2; } st1; void main() { clrscr(); gotoxy(1,1); do { printf("\nThis is library module\n1.Issue book\n2.Return book\n3.View issued books\n4.Student info\n5.View student info\n6.Exit\n7.Issued by one student "); scanf("%d",&choice); switch(choice) { case 1: issue(); break; case 2: returned(); break; case 3: view1(); break; case 4: studinfo(); break; case 5: viewstfo(); break; case 6: exit(0); case 7: stuissue(); break; default: printf("One among 1,2,3,4"); getch(); } }while(choice!='6'); } void issue() //Function definitions int choice;
char temp[idn];
char btemp[idn]; FILE *fp; fp=fopen("boissue.rec","ab"); printf("\nEnter book id:"); chk_id(btemp,idn); strcpy(iss1.bid,btemp); { getdate(&d); printf("\nTodays date:%d",d.da_day); iss1.isdate=d.da_day; } iss1.redate=iss1.isdate+10; struct date d;
printf("\nEnter student's ID:"); chk_id(temp,idn); strcpy(iss1.sid,temp); fwrite(&iss1,sizeof(iss1),1,fp); printf("\nINfo saved , can be issued"); printf("\nExpected date of return is comming: %d",iss1.redate); } { int ch; FILE *fp; fp=fopen("boissue.rec","rb"); printf("Enter book's code:"); chk_id(temp,idn); while(fread(&iss1,sizeof(iss1),1,fp)&&strcmp(temp,iss1.bid)); ch=strcmp(temp,iss1.bid); if(ch!=0) { else { fseek(fp,ftell(fp)-sizeof(iss1),0); fwrite(&iss1,sizeof(iss1),1,fp); printf("Book returned"); printf("No such book");} void returned() char temp[idn];
} fclose(fp); } void chk_name(char *p,int size) { int i=0; do { ch=getch(); if(((ch>='a' && ch<='z')||(ch==' ')||(ch>='A'&& ch<='Z'))&&(i<size-1)) { i++; printf("%c",ch); } else if(ch==8 &&i>0) { i--; p--; } } c[i]='\0'; *p='\0'; } { int i=0; do { ch=getch(); if((ch>='0' && ch<='9')&&(i<size-1)) { i++; p++; printf("%c",ch); *p=ch; void chk_id(char *p,int size) char ch; while(ch!=13); printf("%c%c%c",8,32,8); *p++=ch; char ch,c[30];
} else if(ch==8 &&i>0) { i--; p--; } } *p='\0'; } int duplicate(char temp[]) { FILE *fp; fp=fopen("boissue.rec","rb"); while(fread(&iss1,sizeof(iss1),1,fp)&&strcmp(iss1.sid,temp)); fclose(fp); if(strcmp(temp,iss1.sid)==0) return 1; else return 0; } { FILE *fp; fp=fopen("boissue.rec","rb"); if(fp!=NULL) { while(fread(&iss1,sizeof(iss1),1,fp)) if(strcmp(iss1.sid," ")!=0) { printf("\nStudent ID:%s date:%d\n",iss1.sid,iss1.bid,iss1.isdate,iss1.redate); } if(strcmp(iss1.sid," ")==NULL) { else printf("Not found"); }} Book ID:%s Issue date:%d Due return int ch; while(ch!=13 || i<size-1); printf("%c%c%c",8,32,8);
*/ void studinfo() { char temp[idn]; FILE *fp; if(fp!=NULL) { fp=fopen("studinfo.rec","ab"); do { printf("\nEnter unique student ID:"); chk_id(temp,idn); } strcpy(st1.sid,temp); printf("\nEnter student's name:"); chk_name(st1.sname,nm); fwrite(&st1,sizeof(st1),1,fp); fclose(fp); } { } int duplicatest(char temp[]) { FILE *fp; fp=fopen("studinfo.rec","rb"); while(fread(&st1,sizeof(st1),1,fp)&&strcmp(st1.sid,temp)); if(strcmp(st1.sid,temp)==0) { else return 0; } { int ch; void viewstfo() return 1; } else printf("File not found"); } while(duplicatest(temp));
FILE *fp; fp=fopen("studinfo.rec","rb"); if(fp!=NULL) { while(fread(&st1,sizeof(st1),1,fp)) if(strcmp(st1.sid," ")!=0) { printf("\nStudent id:%sStudent name:%s ",st1.sid,st1.sname); }
fclose(fp); } { else
printf("File not found"); } } void view1() int ch; FILE *fp,*f; fp=fopen("boissue.rec","rb"); f=fopen("studinfo.rec","rb"); if(fp!=NULL)
{ while(fread(&iss1,sizeof(iss1),1,fp)&&fread(&st1,sizeof(st1),1,f)) if((iss1.sid," ")!=0) if(strcmp(iss1.sid,st1.sid)==0) { printf("\nStudent ID:%s Book ID:%s Student } Issue date:%d Due return date:%d
OUTPUT:-THIS IS LIBRARY MODULE 1. ISSUE BOOK 2. return book 3. view issued books 4. student informations 5. view student information
case 1: book issue.c enter book id : 1234 today date is : 21 09 08 enter student id : 2343 information saved , can be issue expected date of return is coming : 21 09 08
REFRENCES
ANSI C
ANSI C LET US C
BALAGURUSWAMI
KAMTHANI