You are on page 1of 10

HARDWARE USED

OS Name : Microsoft Windows 7


Version : 6.1.7600
System manufacturer : Gigabyte Technology Co.
System type : X86-based PC
Processor : Intel Pentium G2030@3Ghz
RAM : 2.00 GB
Hard Disk : 500 GB
SOURCE CODE
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#include<iomanip.h>
#include<string.h>
#include<stdio.h>

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 search_b(char x[])


{ int f=0;
clrscr();
cout<<"\t\t\t\tSearch results\n\n";
for(int i=0;i<c;i++)
{
if(strcmpi(x,b[i].title)==0)
{
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;
f++;
}
}
if(f==0)
cout<<"GAME not Found ";
getch();
}

void search_au(char s[])


{
int h=0;
clrscr();
cout<<"\t\t\t\tSearch Results\n\n";
for(int i=0;i<c;i++)
{
if(strcmpi(s,b[i].au)==0)
{
cout<<"\nAcc. 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<<endl;
h++;
}
}
if(h==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 2:cout<<"Enter the GAME title ";


char m[30];
gets(m);
search_b(m);
break;

case 3:cout<<"Enter the MAKER name ";


char d[30];
gets(d);
search_au(d);
break;

default: cout<<"Invalid Input";


}
break;

case 4: input();
c++;
break;

case 5: cout<<"Enter the accession number ";


int a;
cin>>a;
issue(a);
break;

case 6: cout<<"Enter the accession number ";


cin>>a;
returnb(a);
break;

case 7: exit(0);

default: cout<<"Invalid Input ";


}
clrscr();
}
while(ch!=7);
getch();
}
OUTPUT

Create Game List:


Display Catalogue:

Search A Game:
Add A Game:

Issue A Game:

Return A Game:

You might also like