Professional Documents
Culture Documents
int c=0;
struct date
{
int d,m,y;
};
struct GAME
{
int accno;
char title[50],au[30],pub[50];
int copies,issued;
float price;
date doa;
}b[50];
void Gameinfo()
{
cout<<"S.No. GameNo Title Maker Publisher Copies Issued Price DOA";
}
void input()
{
cout<<"Enter Game no: ";
cin>>b[c].accno;
cout<<"Enter Title: ";
gets(b[c].title);
cout<<"Enter Maker: ";
gets(b[c].au);
cout<<"Enter Publisher: ";
gets(b[c].pub);
cout<<"Enter the number of copies: ";
cin>>b[c].copies;
cout<<"Enter the number of copies issued: ";
cin>>b[c].issued;
cout<<"Enter the price of Game: ";
cin>>b[c].price;
cout<<"Enter the date of addition: ";
cin>>b[c].doa.d>>b[c].doa.m>>b[c].doa.y;
}
void catalog()
{
Gameinfo();
for(int i=0;i<c;i++)
{
cout<<endl<<setw(4)<<i+1<<setw(9)<<b[i].accno<<setw(12)<<b[i].title<<setw(8)<<b[i].au<<
setw(11)<<b[i].pub<<setw(8)<<b[i].copies<<setw(7)<<b[i].issued<<setw(9)<<b[i].price<<setw
(10)<<
setw(4)<<b[i].doa.d<<"\\"<<b[i].doa.m<<"\\"<<b[i].doa.y;
}
getch();
}
void search_a(int a)
{
int w=0;
clrscr();
cout<<"\t\t\t\tSearch Results\n";
for(int i=0;i<c;i++)
{
if(a==b[i].accno)
{
cout<<"Acc. No. : "<<b[i].accno<<"\nTitle : "<<b[i].title<<"\nMAKER :
"<<b[i].au<<
"\nCopies : "<<b[i].copies<<"\nCopies Issued: "<<b[i].issued<<"\nPrice :
"<<b[i].price<<
"\nDate of Issue: "<<b[i].doa.d<<"\\"<<b[i].doa.m<<"\\"<<b[i].doa.y;
w++;
}
}
if(w==0)
cout<<"GAME not Found ";
getch();
}
void issue(int a)
{
int o=0;
for(int i=0;i<c;i++)
{
if(a==b[i].accno)
{
o++;
if(b[i].copies-b[i].issued>0)
{
cout<<"Issued";
b[i].issued++;
}
else
cout<<"\n Out of Stock";
}
}
if(o==0)
cout<<"GAME n ot Found";
getch();
}
void returnb(int a)
{
int r=0;
for(int i=0;i<c;i++)
{
if(a==b[i].accno)
{
b[i].issued--;
cout<<"\n Successfully Returned ";
r++;
}
}
if(r==0)
cout<<"\n Invalid Input ";
getch();
}
void main()
{
clrscr();
int ch;
do
{ cout<<"\n\t\t\t Game Store Management System\n\n\t\t\t\t 1-Create GAME List \n\t\t\t\t 2-
Display Catalogue \n\t\t\t\t 3-Search a GAME \n\t\t\t\t 4-Add a GAME \n\t\t\t\t 5-Issue a GAME
\n\t\t\t\t 6-Return a GAME \n\t\t\t\t 7-Exit \n\n Enter you choice: ";
cin>>ch;
clrscr();
switch(ch)
{
case 1: char x;
do
{
input();
c++;
cout<<"\n Do you want to add more (Y/N)";
cin>>x;
}
while(x=='y' || x=='Y');
break;
case 2: catalog();
break;
case 3: int v;
cout<<"\n 1-Search by accession number \n 2-Search by GAME name \n 3-Search by
MAKER name \n Enter your choice ";
cin>>v;
switch(v)
{
case 1: cout<<"Enter the accession number ";
int a;
cin>>a;
search_a(a);
break;
case 4: input();
c++;
break;
case 7: exit(0);
Search A Game:
Add A Game:
Issue A Game:
Return A Game: