.h" #include"conio.h" #include"fstream.h" #include"stdlib.h" #include"dos.h" #in clude"string.h" #include"graphics.h" #include"iomanip.h" //******************* ************************************ // CLASS NAME : BOOK //******************** *********************************** class book { public: char name[20]; char a uthor[20]; int a; void getdata(); void show(); }; //************************** ***************************** // FUNCTIONS TO GET AND SHOW DATA //******* ************************************************ void book::getdata() { cout< <"\n\" \"ENTER DETAILS ABOUT BOOK U WANT TO PURCHASE\" :\""; cout<<"\n\n\n\t\tEn ter Name Of Book :\t"; cin>>name; cout< <"\n\t\tEnter Name Of Author :\t"; cin>> author; fflush(stdin); cout< <"\n\t\tEnter No. Of Copies :\t"; cin>>a; } void bo ok::show() { cout< <"BOOK :"<=240;y=y-10,x[0]=x[0]+13,x[2]=x[2]+6,x[1]+=11,x[3 ]-=4,x[4]-=9) { fillellipse(x[0],y,20,20);setfillstyle(1,GREEN); fillellipse(x[1 ],y,20,20); setfillstyle(1,YELLOW); fillellipse(x[2],y+10,20,20);setfillstyle(1, WHITE); fillellipse(300,y-15,20,20); setfillstyle(1,6); fillellipse(x[3],y-5,20, 20); setfillstyle(1,BLUE); fillellipse(x[4],y+20,20,20); setfillstyle(1,CYAN); clearviewport(); for(int c=440;c<480;++c) { setlinestyle(0,1,3);setcolor(BLACK) ; line(0,c,325,480); line(680,c,325,480); } delay(20); } for (int c=0;c<150;++ c) { setcolor(BLACK); fillellipse(325,240,c*1.5,c); delay(10);} setcolor(BLACK); settextstyle(7,0,5); outtextxy(115,200,"B O O K - S H O P"); getch(); clearviewp ort(); } void main() { clrscr(); int gdriver=DETECT,gmode; initgraph(&gdriver, &gmode,"\\tc\\bgi"); graph(); rectangle(10,10,630,470); setbkcolor(RED); rectang le(10,10,630,470); settextstyle(GOTHIC_FONT,0,4); setcolor(WHITE); outtextxy(30, 35,"Developed By:-"); settextstyle(10,0,3); outtextxy(150,100,"*iCBSE.com"); get ch(); char s; book b1; z: fstream f; f.open("book",ios::in|ios::out|ios::app|i os::ate|ios::binary); clearviewport(); settextstyle(10,HORIZ_DIR,3); setbkcolor( GREEN); rectangle(10,10,630,470); outtextxy(100,15,"WHAT DO U WANT TO DO:"); set textstyle(SANS_SERIF_FONT,0,3); outtextxy(250,100,"1 . TO BUY"); outtextxy(250,1 50,"2 . TO SHOW ALL BOOKS"); outtextxy(250,200,"3 . TO CHECK AVAILABILITY"); out textxy(250,250,"4 . TO MODIFY"); outtextxy(250,300,"5 . TO DELETE"); outtextxy(2 50,350,"6 . TO EXIT"); int a; settextstyle(7,0,5); outtextxy(20,400, "ENTER UR C HOICE:"); f.seekg(0); gotoxy(55,25); cin>>a; char x; gotoxy(1,1); switch (a) { //******************************************************* // CASE : 1 // DETAILS : TO ADD A BOOK S RECORD //*********************************************** ******** case 1: gotoxy(1,1); clearviewport(); rectangle(10,10,630,470); setbk color(RED); textbackground(13); textcolor(6); clrscr(); fstream f; f.open("book" ,ios::in|ios::out|ios::ate|ios::app|ios::binary); char ans; b1.getdata(); f.writ e((char *)&b1,sizeof(b1)); getch(); settextstyle(7,0,1); outtextxy(250,410,"Do Y ou Want To Continue:"); ans=getchar(); if(ans=='Y' || ans=='y') goto z; else b reak; //******************************************************* // CASE : 2 // DETAILS : TO SHOW ALL BOOKS RECORDS //*********************************** ******************** case 2: { clearviewport(); rectangle(10,10,630,470); setb kcolor(LIGHTBLUE); textbackground(3); textcolor(6); cout< <"\n\n"; fstream f; f. open("book",ios::in|ios::out|ios::ate|ios::app|ios::binary); char ans; f.seekg(0 ); int ctr=0; while(f.read((char *)&b1,sizeof(b1)) ) { ctr=ctr+1; if(ctr==8) { g etchar(); clrscr(); ctr=0; } b1.show(); if(f.eof()==1) { break; } } f.close(); s ettextstyle(7,0,1); outtextxy(250,410,"Do You Want To Continue:"); cin>>ans; if( ans=='y'|| ans=='Y') goto z; else { closegraph(); exit(1); } } //************* ****************************************** // CASE : 3 // DETAILS : TO CHE CK AVAILABILITY //******************************************************* case 3: { gotoxy(60,25); clearviewport(); rectangle(10,10,630,470); setbkcolor(DARKG RAY); textbackground(3); textcolor(5); clrscr(); char ans; ifstream f; book b1; char name[20]; char author[20]; int a; f.open("book",ios::in|ios::binary); cout< <"\n\n\n Enter book name whose record to be seen :"; cin>>name; do { f.read((ch ar *)&b1,sizeof(b1)); if(f.eof()==1) {break;} if(strcmp(b1.name,name)==0) { cout < <"\n Name :"<>name; do { f.read((char *)&b1,sizeof(b1)); if(f.eof()==1) {break ;} if(strcmp(b1.name,name)==0) { cout< <"\n Name :"<>name; cout< <"\n Enter auth or name :"; cin>>author; cout< <"\n Enter no. of copies :"; cin>>a; strcpy(b1.na me,name); strcpy(b1.author,author); b1.a=a; int l=f.tellg(); f.close(); f.open("