Вы находитесь на странице: 1из 4

#include<iostream.

h>
#include<conio.h>
#include<string.h>
class bdata //bdata mean book data
{
private:
int a[20];
char subtitle[20], athname[20], keyd[20];
int edit;
public:
void input()
{
cout<<"enter title :";
cin.get(subtitle,50);
cin.ignore();
cout<<"enter auther name:";
cin.get(athname,50);
cin.ignore();
cout<<"enter keyword:";
cin.get(keyd,50);
cin.ignore();
cout<<"enter edition:";
cin>>edit;
}
void display()
{
cout<<"title:"<<subtitle<<endl;
cout<<"auther name:"<<athname<<endl;
cout<<"keyword:"<<keyd<<endl;
cout<<"edition:"<<edit<<endl;
}
void sbyTitle (char x[])
{
{
if(strcmp(x,subtitle) == 0)
{
cout<<"rec found \n"<<endl;
cout<<"title "<<subtitle<<endl<<"author name "
<<athname<<endl<<"edition "
<<edit<<endl
<<"kryword: "<<keyd<<endl;
// a++;
// break;
}
}
if(a == 0)
{
cout<<"Record not found ";
}
}

// a function for search by author name


void sbyAuther (char y[])
{
{
if(strcmp(y,athname) == 0)
{
cout<<"rec found \n";
cout<<"title "<<subtitle<<endl<<"author name "
<<athname<<endl<<"edition "
<<edit<<endl
<<"type "<<keyd<<endl;
// a++;
// break;
}
}
if(a == 0)
{
cout<<"Record not found ";
}
}

////////////////////////////////////////////////////////////////////////////////
////
void sbyKey(char z[]) //search by key
{
{
if(strcmp(z,keyd)== 0)
{
cout<<"rec found \n";
cout<<"title "<<subtitle<<endl<<"author name "
<<athname<<endl<<"edition "
<<edit<<endl
<<"type "<<keyd<<endl;
// a++;
// break;
}
}
if(a == 0)
{
cout<<"Record not found ";
}
}
};
void main()
{
char x[20];
const int size = 3;
int i, j, s;
bdata b1[size];
cout<<endl<<endl;

int input;
do
{
cout<<"****************LIBRARY INFORMATION SYSTEM*****************"<<endl;
cout<<"\n option 1 to insert record\n\n";
cout<<" option 2 to search by title\n\n";
cout<<" option 3 to search by auther name \n\n";
cout<<" option 4 to search by keywrd \n\n";
cout<<" option 5 delete record\n\n";
cout<<" option 6 to display record \n\n";
cout<<" option 7 to terminate\n";
cin>>input;
cin.ignore();

if(input==1)
for(i=0;i<size;i++)
{
b1[i].input();
cin.ignore();
cout<<endl<<endl;
}
if(input==6)

for(j=0;j<size;j++)
{
b1[j].display();
}
if(input==2)
////////////////////////////////////////////////////////////////////////
//
{
cout<<" enter the title :";
cin.get(x,20);
cin.ignore();
for(s=0;s<size;s++)
{
b1[s].sbyTitle(x);
cout<<endl<<endl;
}
}
if(input==3)

////////////////////////////////////////////////////////////////////////////////
{ int a = 0;
cout<<" enter the auther name :";
cin.get(x,20);
cin.ignore();
for(int c=0;c<size;c++)
{
b1[c].sbyAuther(x);
cout<<endl<<endl;
}
}
if(input==4)
{
cout<<" enter the kyeword :";
cin.get(x,20);
cin.ignore();
for( int g=0;g<size;g++)
{
b1[g].sbyKey(x);
cout<<endl<<endl;
}
}
}
while(input != 7);
}

Вам также может понравиться