What's New-Given Below
technicalsymposium
technicalsymposium
technicalsymposium

C/C++ Lab Program(s)/Materials


C Program for Library Operation.

#include<stdio.h>
#include<conio.h>
int i=0;
void add();
void search();
void sort();
void sorta();
struct book
{
char bookname[50];
char author[50];
double price;
int nocopy;
}book[50];
void main()
{
int ch;
while(1)
{
clrscr();
printf("********************");
printf("\nLIBRARY MANAGEMENT");
printf("\n******************");
printf("\n1-ADD TO LIBRARY");
printf("\n2-SEARCH A BOOK");
printf("\n3-SORT BY BOOK NAME");
printf("\n4-SORT BY AUTHOR NAME");
printf("\n5-EXIT");
printf("\nEnter your choice:");
scanf("%d",&ch);
switch(ch)
{
case 1: add();
break;
case 2: search();
break;
case 3: sort();
break;
case 4: sorta();
break;
case 5: exit(0);
default: puts("Please enter 1-5 only");
getch();
}
}
}
void add()
{
printf("\n\nADD TO LIBRARY");
printf("\nEnter the Bookname: ");
fflush(stdin);
gets(book[i].bookname);
printf("\nEnter the Author name: ");
fflush(stdin);
gets(book[i].author);
printf("\nEnter the Price of the Book: ");
scanf("%ld",&book[i].price);
printf("\nEnter no of copies : ");
scanf("%d",&book[i].nocopy);
printf("STORED");
printf("\nBOOK NAME: %s",book[i].bookname);
printf("\nAUTHOR : %s",book[i].author);
printf("\nPRICE : %d",book[i].price);
printf("\nNO OF COPIES: %d",book[i].nocopy);
i++;
getch();
}
void search()
{
int f=0,y,j,x;
char bookn[50],authorname[50];
printf("\n Enter the Book Name: ");
fflush(stdin);
gets(bookn);
printf("\n Enter the Author Name: ");
fflush(stdin);
gets(authorname);
printf("\nThe Given Search");
printf("\nThe Book Name is: %s",bookn);
printf("\nThe Author Name is : %s",authorname);
for(j=0;j<i;j++)
{
x= strcmp(book[j].bookname,bookn);
y=strcmp(book[j].author,authorname);
if(x==0&&y==0)
{
printf("\nBOOK IS FOUND");
getch();
f=1;
}
}
if(f==0)
{
printf("\nBOOK NOT FOUND");
getch();
}
getch();
}
void sort()
{
int j,k,x;
char t[50];
for(j=0;j<i;j++)
{
for(k=0;k<j;k++)
{
x = (strcmp(book[k].bookname,book[k+1].bookname));
if(x>0)
{
strcpy(t,book[k].bookname);
strcpy(book[k].bookname ,book[k+1].bookname);
strcpy(book[k+1].bookname, t);
}
}
}
printf("\nSORTED BY BOOK NAME");
for(j=0;j<i;j++)
{
printf("\nThe BookName is:%s - %s",book[j].bookname,book[j].author);
}
getch();
}
void sorta()
{
int j,k,x;
char t[50];
for(j=0;j<i;j++)
{
for(k=0;k<j;k++)
{
x = (strcmp(book[k].author,book[k+1].author));
if(x>0)
{
strcpy(t,book[k].author);
strcpy(book[k].author ,book[k+1].author);
strcpy(book[k+1].author, t);
}
}
}
printf("\nSORTED BY AUTHOR NAME");
for(j=0;j<i;j++)
{
printf("\nThe AUTHOR NAME is:%s - %s",book[j].author,book[j].bookname);
}
getch();
}

technicalsymposium

Technicalsymposium.com-A Complete Website for Engineering Students & Engineering Faculties.All Useful Links & Contents Given Below

technicalsymposium

Free Email Alerts
Get free email alerts-Fresher’s Jobs/Conference/Symposium/Exams Alerts-Click here to Subscribe.

Free Event Publishing
Publish your college technical symposium/free events in our website & Attract more targeted audience- Click here to Get

Conference/Symposium
All engineering colleges /Premier Institutions (IIT,IISC,NIT,etc.,) Conferences/Workshop details-Click here to Get

Fresher’s Jobs/Scholarships Details
Freshers Software Jobs/Government Jobs and Student Internships/Scholarships Details- Click here to Get

Placement Papers
All Software Companies previous placement papers/Govt Competitive exam previous papers/Tech Materials free download-Click her to get.

Lab Programs/Lab Manuals
All Branches of Lab Programs/Lab Manuals for all branches of Engineering-Click here to Get

University Previous Question Papers
Anna university/All leading universities previous question papers year wise and Semester wise- Click here to Get

GATE Question Papers
GATE Previous Question Papers –All Branches by year wise-Click here to Get

Indian Engineering Services (IES) Question Papers
IES Previous Question Papers –All Branches by year wise-Click here to Get

Anna University Syllabus
Anna University all branches syllabues free download for all B.E(All Branches)/B.Tech(All Branches)/M.E/M.Tech/MCA/MBA- Click here to Get

GATE/ All Entrance Exam Syllabus
GATE/ All Leading Entrance Exam Syllabus free download-Click here to Get

Competitive Exam Syllabuses
Bank/Railway/SSC,all kind of Competitive Exam syllabuses free Download-Click here to get

Civil Engineering Lecture Notes
Civil engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Electronics & Communication Engineering (ECE) Lecture Notes
Electronics & Communication Engineering (ECE) by semester wise and Lab Programs/Manuals-Click here to get

Electronics & Electronics Engineering (EEE) Lecture Notes
Electronics & Electronics Engineering (EEE) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Mechanical Engineering (MECH) Lecture Notes
Mechanical Engineering (MECH) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Computer Science Engineering (CSE) Lecture Notes
Computer Science Engineering (CSE) lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Information Technology Lecture Notes
Information Technology lecture notes by semester wise and Lab Programs/Manuals-Click here to get

MCA Lecture Notes
MCA lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Automobile Engineering Lecture Notes
Automobile Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Aeronautical Engineering Lecture Notes
Aeronautical Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Bio-Medical Engineering Lecture Notes
Bio-Medical Engineering lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Bio-Technology Lecture Notes
Bio-Technology lecture notes by semester wise and Lab Programs/Manuals-Click here to get

MBA Lecture Notes
MBA lecture notes by semester wise and Lab Programs/Manuals-Click here to get

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com