branchx void Libseeint x int ibcont0 char ch100 systemcls bbranchx ifstream

Branchx void libseeint x int ibcont0 char ch100

This preview shows page 18 - 22 out of 34 pages.

branch(x); } } void Lib::see(int x) { int i,b,cont=0; char ch[100]; system("cls"); b=branch(x); ifstream intf("Booksdata.txt",ios::binary); if(!intf) { cout<<"\n\t\tFile Not Found.\n"; cout<<"\n\t\t->Press any key to continue ..... "; getch(); system("cls"); if(x==1) student(); else librarian(); } system("cls"); cout<<"\n\t\tPlease Choose one option :-\n"; cout<<"\n\t\t[1] Search By Name\n\n\t\t[2] Search By Book's ID\n"; cout<<"\n\t\tEnter Your Choice : "; cin>>i; fflush(stdin); intf.read((char*)this,sizeof(*this)); if(i==1) { cout<<"\n\t\tEnter Book's Name : "; cin.getline(ch,100); system("cls"); while(!intf.eof()) { for(i=0;b==B&&q!=0&&bookname[i]!='\0'&&ch[i]!='\0'&&(ch[i]==bookname[i]|| ch[i]==bookname[i]+32);i++); if(bookname[i]=='\0'&&ch[i]=='\0') { cout<<"\n\t\tBook Found :-\n"; show(x); cont++; break; } intf.read((char*)this,sizeof(*this)); } } else if(i==2) { cout<<"\n\t\tEnter Book's ID : "; cin.getline(ch,100); system("cls"); while(!intf.eof()) { 18 | P a g e
Image of page 18
for(i=0;b==B&&q!=0&&sc[i]!='\0'&&ch[i]!='\0'&&ch[i]==sc[i];i++); if(sc[i]=='\0'&&ch[i]=='\0') { cout<<"\n\t\tBook Found :-\n"; show(x); cont++; break; } intf.read((char*)this,sizeof(*this)); } } else { cont++; system("color 47"); cout<<"\n\t\tPlease enter correct option :("; getch(); system("color 5e"); system("cls"); see(x); } intf.close(); if(cont==0) cout<<"\n\t\tThis Book is not available :( \n"; system("color 47"); cout<<"\n\t\tPress any key to continue ..... "; getch(); system("color 5e"); system("cls"); if(x==1) student(); else librarian(); } void Lib::issue() { char st[50],st1[20]; int b,i,j,d,m,y,dd,mm,yy,cont=0; system("cls"); cout<<"\n\t\t->Please Choose one option :-\n"; cout<<"\n\t\t1.Issue Book\n\n\t\t2.View Issued Book\n\n\t\t3.Search student who issued books\n\n\t\t4.Reissue Book\n\n\t\t5.Return Book\n\n\t\t6.Go back to menu\n\n\t\tEnter Your Choice : "; cin>>i; fflush(stdin); if(i==1) { system("cls"); b=branch(2); system("cls"); fflush(stdin); 19 | P a g e
Image of page 19
cout<<"\n\t\t->Please Enter Details :-\n"; cout<<"\n\t\tEnter Book Name : "; cin.getline(bookname,100); cout<<"\n\t\tEnter Book's ID : "; cin.getline(sc,20); //strcpy(st,sc); der(sc,b,1); cout<<"\n\t\tEnter Student Name : "; cin.getline(auname,100); cout<<"\n\t\tEnter Student's ID : "; cin.getline(sc1,20); cout<<"\n\t\tEnter date : "; cin>>q>>B>>p; ofstream outf("student.txt",ios::binary|ios::app); outf.write((char*)this,sizeof(*this)); outf.close(); cout<<"\n\n\t\tIssue Successfully.\n"; } else if(i==2) { ifstream intf("student.txt",ios::binary); system("cls"); cout<<"\n\t\t->The Details are :-\n"; intf.read((char*)this,sizeof(*this)); i=0; while(!intf.eof()) { i++; cout<<"\n\t\t********** "<<i<<". ********** \n"; cout<<"\n\t\tStudent Name : "<<auname<<"\n\t\t"<<"Student's ID : "<<sc1<<"\n\t\t"<<"Book Name : "<<bookname<<"\n\t\t"<<"Book's ID : "<<sc<<"\n\t\t"<<"Date : "<<q<<"/"<<B<<"/"<<p<<"\n"; intf.read((char*)this,sizeof(*this)); } intf.close(); } else if(i==3) { system("cls"); fflush(stdin); cout<<"\n\t\t->Please Enter Details :-\n"; cout<<"\n\n\t\tEnter Student Name : "; cin.getline(st,50); cout<<"\n\n\t\tEnter Student's ID : "; cin.getline(st1,20); system("cls"); ifstream intf("student.txt",ios::binary); intf.read((char*)this,sizeof(*this)); cont=0; while(!intf.eof()) { for(i=0;sc1[i]!='\0'&&st1[i]!='\0'&&st1[i]==sc1[i];i++); if(sc1[i]=='\0'&&st1[i]=='\0') { cont++; 20 | P a g e
Image of page 20
if(cont==1) { cout<<"\n\t\t->The Details are :-\n"; cout<<"\n\t\tStudent Name : "<<auname; cout<<"\n\t\tStudent's ID : "<<sc1; } cout<<"\n\n\t\t******* "<<cont<<". Book details *******\n"; cout<<"\n\t\tBook Name : "<<bookname; cout<<"\n\t\tBook's ID : "<<sc; cout<<"\n\t\tDate : "<<q<<"/"<<B<<"/"<<p<<"\n"; } intf.read((char*)this,sizeof(*this)); } intf.close(); if(cont==0) cout<<"\n\t\tNo record found."; } else if(i==4) { system("cls"); fflush(stdin); cout<<"\n\t\t->Please Enter Details :-\n"; cout<<"\n\n\t\tEnter Student's ID : "; cin.getline(st,50);
Image of page 21
Image of page 22

You've reached the end of your free preview.

Want to read all 34 pages?

  • Fall '16
  • getch, long int n1, t Please Login

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes