C++ Project on Library

Submitted by Editor

Project on Library

/*
Program Title : Library
Website: http://www.cbseportal.com
There is some personal infomation in the introduction and end. Please remove them before use.
*/

#include
#include
#include
#include
#include
#include
#include
#include
#include
class lib
{
public:
char name[20];
int clas,rollno;
void get()
{cout<<"*******enter the details of the student:"<>clas;
cout<<"enter the rollno:"<>rollno;
}
void show()
{
cout<<"********DETAILS ADDED ARE***********:"<>x;
switch(x)
{
case 1:
{
 char ch='y';
lib s;
fstream t;
t.open("navi.txt",ios::binary|ios::out|ios::app|ios::in);
while(ch=='y'||ch=='Y')
{
s.get();
t.write((char*)&s,sizeof(lib));
cout<<"do you want to add more(y/n)....:"<>ch;
}
}

case 2:
{
lib s;
fstream t;
t.open("navi.txt",ios::binary|ios::out|ios::app|ios::in);
t.seekg(0);
while(t.read((char*)&s,sizeof(lib)))
{
s.show();
}
}
break;
case 3:
{ int a[20];
lib s;
fstream t;
t.open("navi.txt",ios::binary|ios::out,ios::app|ios::in);
t.seekg(0);
cout<<"enter the name you want to search:"<>a[i];
while(t.read((char*)&s,sizeof(lib)))
{


s.show();
}
cout<<"name not found:";
}
}
}
}


Add Your Comment - Guidelines
You can express your opinion or reaction in the form below!

100 characters required

0 Comments:

Be the first one to comment!

You may also want to see:
QUOTE OF THE DAY
Life isn't about finding yourself. Life is about creating yourself. - George Bernard Shaw
April 19th, 2024 - Friday
background

Sign in to continue