C++ Project on Library Management

Submitted by Editor

Library

 
#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
Love isn't something you find. Love is something that finds you. - Loretta Young
April 26th, 2024 - Friday
background

Sign in to continue