Escolar Documentos
Profissional Documentos
Cultura Documentos
PROJECT FILE
ON
CRICKET RECORD
PROJECT BY:
HIMANSHU MATHPAL
XII-A
SESSION: 2018-2019
Certificate
Acknowledgement
Coding
Limitations
Requirements
Bibliography
Acknowledgement
I thank my Computer Science teacher
Mrs. Renu Manglik for guidance and
support. I also thank my Principal Mrs.
Monita Gopal. I would also like to
thank my parents and my sister for
encouraging me during the course of
this project. Finally I would like to
thank CBSE for giving me this
opportunity to undertake this project.
Certificate
This is to certify that Himanshu Mathpal of class 12th,
Universal Public School, Delhi has successfully
completed his project in computer science practical
for the AISSCE as prescribed by CBSE in the year 2018-
2019.
Date:
Registration No.:
__________________ __________________
REQUIREMENTS
HARDWARE REQUIRED
Printer, to print the required documents of the project
Compact Drive
Processor : Pentium III
Ram : 64 MB
Hard disk : 20 GB
SOFTWARE REQUIRED
Operating system : Windows XP
Turbo C++, for execution of program and
Ms word, for presentation of output.
HEADER FILES USED AND
THEIR PURPOSE
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;
}
cout<<"PLAYER CODE:"<<playercode<<endl;
cout<<"PLAYER NAME: "<<name<<endl;
cout<<"FIRST MATCH RUN(S): "<<M1R<<endl;
cout<<"SECOND MATCH RUN(S): "<<M2R<<endl;
cout<<"THIRD MATCH RUN(S): "<<M3R<<endl;
cout<<"TOTAL RUN(S): "<<total_run<<endl;
}
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;
}
file.read((char*)&d,sizeof(d));
while(file)
{
run=d.gettotalruns();
if(run>tr)
{
post=file.tellg();
tr=run;
}
file.read((char*)&d,sizeof(d));
}file.close();
file.open("RECORD.DAT",ios::in|ios::binary);
file.seekg(post-sizeof(d));
file.read((char*)&d,sizeof(d));
cout<<"\n::::::::::HIGHEST RUN GETTER DATA::::::::::";
cout<<"\nHIGHEST RUN(S) GETTER CODE : "<<d.getplayercode();
cout<<"\nHIGHEST RUN(S) GETTER PLAYER IS : "<<d.get_name();
cout<<"\nPLAYER TOTAL RUN(S) ARE : "<<tr;
float avg;
avg=(tr)/3;
cout<<"\nPLAYER AVERAGE IS : "<<avg;
file.close();
}
//* * * * * * * * * * * * INSERT NEW RECORD(s) * * * * * * * * * * * * *
void insert()
{
int i,no;
file.open("RECORD.DAT",ios::in|ios::app|ios::binary);
cout<<"\n ::ENTRY OF NEW RECORD(S):: ";
cout<<"\nHOW MANY RECORD DO YOU WANT TO ENTER: ";
cin>>no;
for(i=1;i<=no;i++)
{
d.enter_name_runs(); //insert records
file.write((char*)&d,sizeof(d));
}file.close();
}
//* * * * * * * * * * * * * DISPLAY EXISTING RECORD(s) * * * * * * * * * *
void display()
{
file.open("RECORD.DAT",ios::in|ios::binary);
cout<<"|||||||||||||||||||||| ENTERED RECORD(S) ||||||||||||||||||||||||"<<endl;
file.read((char*)&d,sizeof(d));
while(file)
{
d.show_record();
file.read((char*)&d,sizeof(d));
}file.close();
}
//* * * * * * * * * * * * * SEARCH RECORD * * * * * * * * * * * * * * * *
void search()
{
int p,r,f=0;
file.open("RECORD.DAT",ios::in|ios::binary);
cout<<"\nENTER PLAYER CODE TO SEE HIS RECORD: ";
cin>>r;
file.seekg(0);
file.read((char*)&d,sizeof(d));
while(file)
{
p=d.getplayercode();
if(r==p)
{
d.show_record();
f=1;
break;
}
else
{
file.read((char*)&d,sizeof(d));
}
}file.close();
if(f==0)
{
cout<<"\nTHERE IS NO RECORD WHICH HAVE THIS PLAYER CODE";
}
}
//* * * * * * * * * * * * * * MODIFY DATA * * * * * * * * * * * * * * * * * *
void modify()
{
int posi=0,got=0,dmd=0;
cout<<"\nENTER THE PLAYER CODE WHOSE RECORD IS TO BE MODIFIED: ";
cin>>dmd;
int ifdata=1;
file.open("RECORD.DAT",ios::in|ios::out|ios::binary);
posi=file.tellg();
while(file)
{
file.read((char*)&d,sizeof(d));
got=d.getplayercode();
if(dmd==got)
{
file.seekg(posi);
d.modify_data();
ifdata=2;
file.write((char*)&d,sizeof(d));
break;
}
posi=file.tellg();
}
file.close();
if(ifdata==1)
{
cout<<" DATA IS NOT AVAILABLE FOR MODIFICATION "<<endl;
}
}
//* * * * * * * * * * * * DELETE RECORD* * * * * * * * * * * * * * * * * *
void delete_record()
{
int pointer=0,remove_record=0,size=0,code_get=0;
// size=sizeof(file);
cout<<"\n ENTER PLAYER CODE WHOSE RECORD IS TO BE DELETED: ";
cin>>remove_record;
file.open("RECORD.DAT",ios::in|ios::out|ios::binary);
file1.open("TEMPO.DAT",ios::in|ios::out|ios::binary);
file.seekg(0);
while(file)
{
file.read((char*)&d,sizeof(d));
code_get=d.getplayercode();
if(remove_record==code_get)
{
cout<<" ";
}
else
{
file1.write((char*)&d,sizeof(d));
}
}
file.close();
file1.close();
remove("RECORD.DAT");
rename("TEMPO.DAT","RECORD.DAT");
}
//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
void main()
{
clrscr();
int choice;
do
{
clrscr();
cout<<"=*=*=*=*=* PLAYER RECORD KEEPING SYSTEM *=*=*=*=*"<<endl;
cout<<"1.INSERT RECORD"<<endl;
cout<<"2.DISPLAY RCEORD"<<endl;
cout<<"3.SEARCH RECORD"<<endl;
cout<<"4.MODIFY RECORD"<<endl;
cout<<"5.HIGHEST RUNS "<<endl;
cout<<"6.DELETE PREVIOUS ENTERED RECORD"<<endl;
cout<<"7.EXIT "<<endl;
cout<<"ENTER YOUR CHOICE: ";
cin>>choice;
clrscr();
switch(choice)
{
case 1: insert();
getch();
break;
case 2: display();
getch();
break;
case 3: search();
getch();
break;
case 4: modify();
getch() ;
break;
case 5: highest();
getch();
break;
case 6: delete_record();
cout<<"ENTERED RECORD IS DELETED";
getch();
break;
case 7: cout<<"EXITING....";
getch();
break;
default: cout<<"WRONG CHOICE";
break;
}
}
while(choice!=7);
getch();
}
Screen shots
MAIN MENUE:
Display :
Search :
Modify :
Delete :
Diplay after deletion :
Exiting:
Bibliography
SUMITA ARORA
CLASS NOTES
GOOGLE
LAST YEAR PROJECT FILE