Bio-Data: NAME-saurabh Verma Class - Xi-D Roll No. - 47

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

P age |1

BIO-DATA

NAME- saurabh verma


Class- xi-d
Roll no.- 47

Project file
2017-18

Submitted to: mrS. ritu kapoor

Sign:
P age |2

game
ManageMent
system
P age |3

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];
int copies,issued;
float price;
P age |4

date doa;
}b[50];

void Gameinfo()
{
cout<<"S.No. Acc.No Title Copies Issued Price DOA";
}

void input(GAME &b)


{
cout<<"\n Enter Game no. ";
cin>>b.accno;
cout<<"\n Enter Title ";
gets(b.title);
cout<<"\n Enter the number of copies ";
cin>>b.copies;
cout<<"\n Enter the number of copies issued ";
cin>>b.issued;
cout<<"\n Enter the price of Game ";
cin>>b.price;
cout<<"\n enter the date of addition ";
cin>>b.doa.d>>b.doa.m>>b.doa.y;
P age |5

void catalog(GAME b[],int s)


{
Gameinfo();
for(int i=0;i<s;i++)
{

cout<<endl<<setw(4)<<i+1<<setw(9)<<b[i].accno<<setw(15)<<b[i].t
itle<<setw(8)<<b[i].copies<<setw(9)<<b[i].issued<<setw(8)<<b[i].pr
ice<<setw(13)
<<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++)
{
P age |6

if(a==b[i].accno)
{
cout<<"Acc. No. : "<<b[i].accno<<"\nTitle : "<<b[i].title<<
"\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(strcmp(x,b[i].title)==0)
{
P age |7

cout<<"Acc. No. : "<<b[i].accno<<"\nTitle : "<<b[i].title<<


"\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 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)
{
P age |8

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++;
P age |9

}
}
if(r==0)
cout<<"\n Invalid Input ";
getch();
}

void main()
{
clrscr();
int ch;
do
{ cout<<"\n\t\t\t\tGame 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-Issue a GAME \n\t\t\t\t 5-Return a GAME \n\t\t\t\t 6-Exit
\n\n Enter you choice: ";
cin>>ch;
clrscr();
switch(ch)
{
case 1: char x;
do
{ input(b[c++]);
P a g e | 10

cout<<"\n Do you want to add more (Y/N)";


cin>>x;
}
while(x=='y' || x=='Y');
break;

case 2: catalog(b,c);
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];
P a g e | 11

gets(m);
search_b(m);
break;

default: cout<<"Invalid Input";


}
break;

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


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

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


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

case 6: exit(0);

default: cout<<"Invalid Input ";


P a g e | 12

}
clrscr();
}
while(ch!=6);
getch();
}
P a g e | 13

Output
P a g e | 14
P a g e | 15
P a g e | 16
P a g e | 17

Bibliography

 School Textbook and Notebook

You might also like