A Project Report
On
Crickect Record
Management
DECLARATION
I hear by declare that the project
work entitled “Cricket Record
Management” submitted to Miss.
Ravina Borsaliwala of Divine Child
High School is prepared by me all the
coding are result of my personal
efforts.
Dev Patel
Class XII ( Science )
CERTIFICATE
This is to certify that the project
work “Cricket Record Management” is
a bonafide record of work done by Dev
Patel under my guidance and
supervision.
Miss. Ravina Bosaliwala
Divine Child High School
ACKNOWLEDGMENT
I am extremely grateful to Miss. Ravina
Borsaliwala, Teacher of Department of
Computer Science for his able guidance and
useful suggestions, which helped me in
completing the project work, in time.
I would also like to thank all the teaching and
non-teaching staff of Computer Science
department who helped me directly or
indirectly in the completion of this project .
Finally, yet importantly, I would like to
express my heartfelt thanks to my beloved
parents for their blessings, my
friends/classmates for their help and wishes
for the successful completion of this project.
CONTENTS
1. HEADER FILE USED
2. FILES GENERATED
3. WORKING DESCRIPTION
4. CODING
5. OUTPUT SCREENS
6. CONCLUSION
7. BIBLIOGRAPHY
HEADER FILE USED
iostream.h : for input output
operation
conio.h : to provide console
input/output
fstream.h : for file manipulation
stdio.h :for standard input output
header
string.h : for string usage
process.h :used in working with
threads and
process
ctype.h :for texting and maping
characters
FILES GENERATED
1. [Link]
2. [Link]
WORKING DESCRIPTION
This is a Cricket Record Management
program to maintain record of scores of
player design to use and maintain
database.
This Program consist of five options:
1. Insert record
2. Display record
3. Serach record
4. Search record
5. Highest run
6. Delete previous entered record
7. Exit
Coding
//CRICKET RECORD KEEPING
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
class data
{char name[30];
int playercode;
int M1R;
int M2R;
int M3R;
int total_run;
public:
data()
{playercode=0;
strcpy(name,"");
M1R=0;
M2R=0;
M3R=0;
total_run=0;
}
void enter_name_runs() //TO TAKE ENTRY OF NEW RECORDS
{cout<<"\nEnter player code(Integral) : ";
cin>>playercode;
cout<<"\nEnter player name : ";
gets(name);
cout<<"\nFirst match run(s) : ";
cin>>M1R;
cout<<"\nSecond match run(s) : ";
cin>>M2R;
cout<<"\nThird match run(s) : ";
cin>>M3R;
total_runs();
}
void show_record() //TO DISPLAY THE RECORDS EXISTING IN THE
FILE
{cout<<"\nPlayer code :"<<playercode;
cout<<"\nPlayer name : "<<name;
cout<<"\nFirst match run(s) : "<<M1R;
cout<<"\nSecond match run(s) : "<<M2R;
cout<<"\nThird match run(s) : "<<M3R;
cout<<"\nTotal run(s) : "<<total_run;
}
void total_runs() //CALCULATE TOTAL RUNS
{total_run=M1R+M2R+M3R;
}
int getplayercode()
{return playercode;
}
int gettotalruns()
{return total_run;
}
char* get_name()
{return name;
}
void modify_data() //TAKE DATA TO MODIFIFY EXISTING
RECORD
{cout<<"\nEnter new data for modification :::::::: ";
cout<<"\nEnter First match run(s) : ";
cin>>M1R;
cout<<"\nEnter Second match run(s) : ";
cin>>M2R;
cout<<"\nEnter Third match run(s) : ";
cin>>M3R;
total_runs();
} };
data d;
fstream file;
fstream file1;
//* * * * * * * * * * CALCULATE HIGHEST RUN(s) * * * *
* * * * * * * * * * * *
void highest()
{ [Link]("[Link]",ios::in|ios::binary);
int post=0,tr=0,plr_code=0,run=0;
[Link]((char*)&d,sizeof(d));
while(file)
{run=[Link]();
if(run>tr)
{post=[Link]();
tr=run;
}
[Link]((char*)&d,sizeof(d));
}[Link]();
[Link]("[Link]",ios::in|ios::binary);
[Link](post-sizeof(d));
[Link]((char*)&d,sizeof(d));
cout<<"\n::::::::::Highest run getter dat[Link]";
cout<<"\nHighest run(s) getter code : "<<[Link]();
cout<<"\nHighest run getter player is : "<<d.get_name();
cout<<"\nPlayer total run(s) are : "<<tr;
float avg;
avg=(tr)/3;
cout<<"\n Player average is : "<<avg;
[Link]();
}
//* * * * * * * * * * * * INSERT NEW RECORD(s) * * *
* * * * * * * * * * * * *
void insert()
{int i,no;
[Link]("[Link]",ios::in|ios::app|ios::binary);
cout<<"\n ::Entry of new record(s):: ";
cout<<"\nHow many record(s) you want to enter : ";
cin>>no;
for(i=1;i<=no;i++)
{d.enter_name_runs(); //insert records
[Link]((char*)&d,sizeof(d));
}[Link]();
}
//* * * * * * * * * * * * * DISPLAY EXISTING RECORD(s)
* * * * * * * * * * * * * *
void display()
{[Link]("[Link]",ios::in|ios::binary);
cout<<"\n|||||||||||||||||||||| Entered record(s)
||||||||||||||||||||||||";
[Link]((char*)&d,sizeof(d));
while(file)
{d.show_record();
[Link]((char*)&d,sizeof(d));
}[Link]();
}
//* * * * * * * * * * * * * SEARCH RECORD * * * * *
* * * * * * * * * * *
void search()
{int p,r,srch=0;
[Link]("[Link]",ios::in|ios::binary);
cout<<"\nEnter the player code to see his records : ";
cin>>r;
[Link](0);
[Link]((char*)&d,sizeof(d));
while(file)
{p=[Link]();
if(r==p)
{d.show_record();
srch=1;
break;
}
else
{ [Link]((char*)&d,sizeof(d));
}
}[Link]();
if(srch==0)
{cout<<"\nThere is no record which have this playercode .";
}
}
//* * * * * * * * * * * * * * MODIFY DATA * * * * *
* * * * * * * * * * * * *
void modify()
{int posi=0,got=0,dmd=0;
cout<<"\nEnter the playercode whose record to be modified : ";
cin>>dmd;
int ifdata=1;
[Link]("[Link]",ios::in|ios::out|ios::binary);
posi=[Link]();
while(file)
{ [Link]((char*)&d,sizeof(d));
got=[Link]();
if(dmd==got)
{[Link](posi);
d.modify_data();
ifdata=2;
[Link]((char*)&d,sizeof(d));
break;
}
posi=[Link]();
}
[Link]();
if(ifdata==1)
{cout<<"\n Data not available for modification ";
}
}
//* * * * * * * * * * * * * * * DELETE RECORD* * * *
* * * * * * * * * * * * * * *
void delete_record()
{int pointer=0,remove_record=0,size=0,code_get=0;
// size=sizeof(file);
cout<<"\n Enter the player code whose record to be deleated : ";
cin>>remove_record;
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link]("[Link]",ios::in|ios::out|ios::binary);
[Link](0);
while(file)
{[Link]((char*)&d,sizeof(d));
code_get=[Link]();
if(remove_record==code_get)
{cout<<" ";
}
else
{ [Link]((char*)&d,sizeof(d));
}
}[Link]();
[Link]();
remove("[Link]");
rename("[Link]","[Link]");
}
//* * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * *
void main()
{clrscr();
int choice;
char ans='n';
do
{cout<<"\n=*=*=*=*=*=*=*=*=* PLAYER RECORD KEEPING SYSTEM
*=*=*=*=*=*=*=*=*=*";
cout<<"\n [Link] RECORD \n [Link] RCEORD \n [Link] RECORD \n
[Link] RECORD \n [Link] RUNS \n [Link] PREVIOUS ENTERED RECORD
\n [Link] ";
cout<<"\n Enter any one of the options : ";
cin>>choice;
switch(choice)
{case 1: insert();
break;
case 2: display();
break;
case 3: search();
break;
case 4: modify();
break;
case 5: highest();
break;
case 6: delete_record();
break;
case 7:
clrscr();
gotoxy(35,12);
cout<<"Thank you........";
getch();
exit(0);
break;
default: cout<<"\n Enter choice between 1 to 6 ";
}
cout<<"\n Do you want to choose any other option ? :(y/n): ";
cin>>ans;
clrscr();
}while(ans=='y'||ans=='Y');
getch();
}
Output
[Link] menu
[Link] record
[Link] record
[Link] record
[Link] record
[Link] run
[Link] previous entered record
[Link]
Bibliography
[Link]
C++ by Sumita Arora