Cricket Database project utilizing C++
Cricket Database project utilizing C++ is superior stage project which makes use of object oriented ideas for implementing this cricket database project. It exhibits all types of stats from the sport reminiscent of nation, matches, bowling,innings, runs, ball performed, fifties, a whole lot, wickets, finest batting performances, finest bowling performances. You possibly can enter information for final match utilizing menu offered on this utility, after that program will information person to offer different enter information.
Cricket Database project Supply Code
1 2 3 4 5 |
<div>#embrace<br />#embrace<br />#embrace<br />#embrace<br />#embrace<br />#embrace #embrace<br />#embrace<br />#embrace<br />/*------------------base class------------------------------*/<br />class participant<br />{<br />float strate,btavg,blavg;<br />int runs,wic,hiscr,bbol,overs,balls,innings,r1,w1,o1,b1,hcen,cen,i1;<br />public:<br />int mat;<br />char title[10];<br />char nation[10];<br />participant();<br />void getdata();<br />void replace();<br />void showdata();<br />void calculation();<br />void search();<br />void modify();<br />void updatetest();<br />void menu();<br />};<br />/*----------------------constructor------------------------------*/<br />participant::participant()<br />{<br />strcpy(title," ");<br />strcpy(nation," ");<br />strate=0;<br />btavg=0;<br />innings=0;<br />balls=0;<br />overs=0;<br />blavg=0;<br />runs=0;<br />wic=0;<br />mat=0;<br />hiscr=0;<br />bbol=0;<br />cen=0;<br />hcen=0;<br />}<br />/* -----------------------------fun for calculation -----------*/<br />void participant::calculation()<br />{<br />strate=(float)(runs/balls)*100;<br />btavg=(float)runs/innings;<br />blavg=(float)overs/wic;<br />}<br />/*---------------------- scan information from person -----------------*/<br />void participant::getdata()<br />{<br />cleardevice();<br />settextstyle(1,0,1);<br />outtextxy(100,50," ENTER DATA ");<br />settextstyle(0,0,1); <br/><p> </p><br/><p>//cout<<"ntt ENTER INFORMATION: nn";<br />cout<<"nnntt Identify: ";<br />will get(title);<br />cout<<"ntt Nation: ";<br />will get(nation);<br />cout<<"ntt Matches: ";<br />cin>>mat;<br />cout<<"ntt Innings: ";<br />cin>>innings;<br />cout<<"ntt Runs: ";<br />cin>>runs;<br />cout<<"ntt Balls Performed: ";<br />cin>>balls;<br />cout<<"ntt Fifties: ";<br />cin>>hcen;<br />cout<<"ntt A whole bunch: ";<br />cin>>cen;<br />cout<<"ntt Overs Bowled: ";<br />cin>>overs;<br />cout<<"ntt Wickets: ";<br />cin>>wic;<br />cout<<"ntt Finest Batting Efficiency: ";<br />cin>>hiscr;<br />cout<<"ntt Finest Bowling Efficiency: ";<br />cin>>bbol;</p><br/><p>}<br />/*-------------- enjoyable used for modification -----------------*/<br />void participant::replace()<br />{<br />//cout<<"nntt ENTER DATA OF LAST MATCHn";<br />cleardevice();<br />settextstyle(1,0,1);<br />outtextxy(100,50," ENTER DATA OF LAST MATCH");<br />settextstyle(0,0,1);<br />cout<<"nnntt Runs: ";<br />cin>>r1;<br />if(r1>100)<br />cen++;<br />if(r1>50&&r1<100)<br /> hcen++;<br />runs+=r1;<br />cout<<"ntt Wickets: ";<br />cin>>w1;<br />wic+=w1;<br />mat++;<br />cout<<"ntt OUT/NOTOUT(y/n): ";<br />char ch=getche();<br />if(ch=='y')<br />innings++;<br />cout<<"ntt Overs Bowled :";<br />cin>>o1;<br />overs+=o1;<br />cout<<"ntt Balls Performed";<br />cin>>b1;<br />balls+=b1;<br />if(hiscr<r1)<br />hiscr=r1;<br />if(bbol<w1)<br />bbol=w1;<br />}<br />/*--------------------- enjoyable for displaying the information --------------*/<br />void participant::showdata()<br />{<br />int x=50;<br />char str[20];<br />cleardevice();<br />rectangle(50,150,610,250);<br />line(50,200,610,200);<br />for(int i=0;i<6;i++)<br /> {<br />x+=80;<br />line(x,150,x,250);<br />}<br />outtextxy( 60,170,"MATCHS");<br />outtextxy(140,170,"RUNS");<br />outtextxy(220,170,"WICKETS");<br />outtextxy(300,170,"AVG(BAT)");<br />outtextxy(380,170,"AVG(BOL)");<br />outtextxy(460,170,"100`s");<br />outtextxy(540,170,"50`s");<br />outtextxy( 50,280,"BEST PERFORMANCE IN A MATCH ::");<br />outtextxy( 50,300,"RUNS : ");<br />outtextxy( 50,320,"WICKETS :");<br />sprintf(str,"%d",mat);<br />outtextxy(60,220,str);<br />sprintf(str,"%d",runs);<br />outtextxy(140,220,str);<br />sprintf(str,"%d",wic);<br />outtextxy(220,220,str);<br />sprintf(str,"%f",btavg);<br />outtextxy(300,220,str);<br />sprintf(str,"%f",blavg);<br />outtextxy(380,220,str);<br />sprintf(str,"%d",cen);<br />outtextxy(460,220,str);<br />sprintf(str,"%d",hcen);<br />outtextxy(540,220,str);<br />settextstyle(1,0,1);<br />sprintf(str,"%s",nation);<br />outtextxy(50,110,str);<br />sprintf(str,"%s",title);<br />outtextxy(50,90,str);<br />settextstyle(0,0,1);<br />sprintf(str,"%d",hiscr);<br />outtextxy(130,300,str);<br />sprintf(str,"%d",bbol);<br />outtextxy(130,320,str);<br />getch();<br />}<br />fstream file,file1,tfile,tfile1;<br />int ch1;<br />/*----------------------------- fundamental -------------*/<br />void fundamental()<br />{<br />participant p;<br />clrscr();<br />int ch,i=0,gm,gd=DETECT;<br />char st[10];<br />int x,y;<br />x=100;<br />y=100;</p><br/><p>initgraph(&gd,&gm,"g:tcbgi");<br />char pname[10],cname[10],password[10]="",c;<br />setbkcolor(BLUE);<br />whereas(!kbhit())<br />{</p><br/><p>settextstyle(1,0,6);<br />outtextxy(150,200,"CRICKETER`S");<br />outtextxy(170,270,"DATABASE");<br />}<br />settextstyle(0,0,1);<br />cleardevice();<br />setcolor(11);<br />settextstyle(1,0,1);<br />outtextxy(100,380,"LOADING...");</p><br/><p>for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />if(i<400&&i>370)<br />delay(40);<br />delay(10);<br />}<br />settextstyle(0,0,1);<br />cleardevice();<br />getch();<br />//cleardevice();<br />/*------------------ beginning menu -------*/<br />int tag;<br />tag:<br />cleardevice();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ONE DAY") ;<br />outtextxy(200,130," 2 :: TEST") ;<br />//cin>>ch1;</p><br/><p>ch1=getche();<br />ch1=ch1-'0';<br />settextstyle(0,0,1);<br />if(ch1==1)<br />{<br />do<br />{<br />cleardevice();<br />//p.menu();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ADD RECORDS ") ;<br />outtextxy(200,130," 2 :: MODIFY RECORDS ") ;<br />outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;<br />outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;<br />outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;<br />outtextxy(200,250," 6 :: BACK") ;<br />outtextxy(200,280," 7 :: EXIT") ;<br />//cin>>ch;<br />ch=getche();<br />ch=ch-'0';</p><br/><p>settextstyle(0,0,1);</p><br/><p>swap(ch)<br />{<br />/*----- ODI insert --------------*/<br />case 1:</p><br/><p>cleardevice();<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::finish);<br />p.getdata();<br />p.calculation();<br />file.write((char*)&p,sizeof(p));<br />file.clear();<br />file.shut();<br />c=getch();<br />break;<br />/*------- ODI title clever search -----------*/</p><br/><p>case 3:</p><br/><p>cleardevice();<br />cout<<"ntt Identify For Search: ";<br />will get(pname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />//if(i>250&&i<300)<br /> // delay(40);</p><br/><p>delay(10);<br />}<br />cleardevice();<br />int flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />break;<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;</p><br/><p>/*-------------- ODI modification --------------*/<br />ca se 2:</p><br/><p>cleardevice();<br />cout<<"nttENTER PASSWORD ";<br />int i=0;<br />whereas(i<6)<br /> {<br />password[i]=getche();<br />cout<<"*";<br />i++;<br />}<br />getch();<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();</p><br/><p>if(!strcmp("vineet",password))<br />{<br />cout<<"ntt Identify For Modification ";<br />will get(pname);<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file1.open("temp1.txt",ios::in|ios::out|ios::ate);<br />if(!tfile1)<br />cout<<"nerror";<br />file1.seekp(0,ios::beg);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{</p><br/><p>if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />p.replace();<br />p.calculation();<br />file1.write((char*)&p,sizeof(p));<br />}<br />else<br />{<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />}<br />file.clear();<br />file.shut();<br />file1.clear();<br />file1.shut();<br />if(flag==1)<br />{<br />take away("ODI.txt");<br />rename("temp1.txt","ODI.txt");</p><br/><p>}<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />}<br />else<br />cout<<"ntt Improper Password";<br />c=getch();<br />break;</p><br/><p>/*------------ ODI nation clever search ------*/<br />case 4:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />//if(i>333&&i<400)<br /> // delay(40);<br />}<br />cleardevice();<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />/*------ ODI record of gamers -----------*/<br />case 5:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />}<br />cleardevice();<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />settextstyle(1,0,1);<br />//cout<<"nntt"< <p.title;</p><br/><p>sprintf(st,"%s",p.title);<br />outtextxy(x,y,st);<br />y=y+30;<br />settextstyle(0,0,1);<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered"; </p><br/><p>//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />case 6:<br />goto tag;<br />//break;</p><br/><p>case 7:<br />exit(0);<br />break;<br />}<br />}whereas(1);<br />}<br />if(ch1==2)<br />{<br />do<br />{<br />cleardevice();<br />//p.menu();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ADD RECORDS ") ;<br />outtextxy(200,130," 2 :: MODIFY RECORDS ") ;<br />outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;<br />outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;<br />outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;<br />outtextxy(200,250," 6 :: BACK") ;<br />outtextxy(200,280," 7 :: EXIT") ;<br />//cin>>ch;<br />ch=getche();<br />ch=ch-'0';</p><br/><p>settextstyle(0,0,1);</p><br/><p>swap(ch)<br />{<br />/*------------------ TEST insert ------------------*/<br />case 1:<br />cleardevice();<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::finish);<br />p.getdata();<br />p.calculation();<br />tfile.write((char*)&p,sizeof(p));<br />tfile.clear();<br />tfile.shut();<br />break;<br />/*------------------ TEST title clever search ------------------*/<br />case 3:<br />cleardevice();<br />cout<<"ntt Identify For Search: ";<br />will get(pname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />int flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />break;<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />c=getch();<br />break;<br />/*------------------ TEST modification ------------------*/<br />case 2:<br />cleardevice();<br />cout<<"nttENTER PASSWORD";<br />int i=0;<br />whereas(i<6)<br /> {<br />password[i]=getche();<br />cout<<"*";<br />i++;<br />}<br />getch();<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();</p><br/><p>if(!strcmp("vineet",password))<br />{<br />cout<<"ntt Identify For Modification ";<br />will get(pname);<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile1.open("temp1.txt",ios::in|ios::out|ios::ate);<br />if(!tfile1)<br />cout<<"nerror";<br />tfile1.seekp(0,ios::beg);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{</p><br/><p>if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"ntt Enter Information For First Inning: ";<br />p.replace();<br />cout<<"ntt Enter Information For Second Inning: ";<br />p.replace();<br />p.mat--;<br />p.calculation();<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />else<br />{<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />tfile1.clear();<br />tfile1.shut();<br />if(flag==1)<br />{<br />take away("TEST.txt");<br />rename("temp1.txt","TEST.txt");</p><br/><p>}<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />}<br />else<br />cout<<"ntt Improper Password";<br />c=getch();<br />break;<br />/*------------------ TEST nation clever search ------------------*/<br />case 4:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />break;<br />/*------------------ TEST record ------------------*/<br />case 5:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />fla g=1;<br />settextstyle(1,0,1);<br />//cout<<"nntt"< <p.title;</p><br/><p>sprintf(st,"%s",p.title);<br />outtextxy(x,y,st);<br />y=y+30;<br />settextstyle(0,0,1);<br />//cout<<"nntt"< <p.title;<br /> </p><br/><p>}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//char c;<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />case 6:<br />goto tag;<br />case 7:<br />exit(0);<br />break;<br />}<br />}whereas(1);<br />}<br />}<br />/* ------------------------------end of fundamental -----------------*/ </p><br/><p>#embrace<br />#embrace<br />#embrace<br />#embrace<br />#embrace<br />#embrace #embrace<br />#embrace<br />#embrace<br />/*------------------base class--------------------------------*/<br />class participant<br />{<br />float strate,btavg,blavg;<br />int runs,wic,hiscr,bbol,overs,balls,innings,r1,w1,o1,b1,hcen,cen,i1;<br />public:<br />int mat;<br />char title[10];<br />char nation[10];<br />participant();<br />void getdata();<br />void replace();<br />void showdata();<br />void calculation();<br />void search();<br />void modify();<br />void updatetest();<br />void menu();<br />};<br />/*----------------------constructor-------------------------------------*/<br />participant::participant()<br />{<br />strcpy(title," ");<br />strcpy(nation," ");<br />strate=0;<br />btavg=0;<br />innings=0;<br />balls=0;<br />overs=0;<br />blavg=0;<br />runs=0;<br />wic=0;<br />mat=0;<br />hiscr=0;<br />bbol=0;<br />cen=0;<br />hcen=0;<br />}<br />/* -----------------------------fun for calculation ----------------------*/<br />void participant::calculation()<br />{<br />strate=(float)(runs/balls)*100;<br />btavg=(float)runs/innings;<br />blavg=(float)overs/wic;<br />}<br />/*---------------------- scan information from person -------------------------*/<br />void participant::getdata()<br />{<br />cleardevice();<br />settextstyle(1,0,1);<br />outtextxy(100,50," ENTER DATA ");<br />settextstyle(0,0,1);</p><br/><p>//cout<<"ntt ENTER INFORMATION: nn";<br />cout<<"nnntt Identify: ";<br />will get(title);<br />cout<<"ntt Nation: ";<br />will get(nation);<br />cout<<"ntt Matches: ";<br />cin>>mat;<br />cout<<"ntt Innings: ";<br />cin>>innings;<br />cout<<"ntt Runs: ";<br />cin>>runs;<br />cout<<"ntt Balls Performed: ";<br />cin>>balls;<br />cout<<"ntt Fifties: ";<br />cin>>hcen;<br />cout<<"ntt A whole bunch: ";<br />cin>>cen;<br />cout<<"ntt Overs Bowled: ";<br />cin>>overs;<br />cout<<"ntt Wickets: ";<br />cin>>wic;<br />cout<<"ntt Finest Batting Efficiency: ";<br />cin>>hiscr;<br />cout<<"ntt Finest Bowling Efficiency: ";<br />cin>>bbol;</p><br/><p>}<br />/*------------------------------ enjoyable used for modification -----------------*/<br />void participant::replace()<br />{<br />//cout<<"nntt ENTER DATA OF LAST MATCHn";<br />cleardevice();<br />settextstyle(1,0,1);<br />outtextxy(100,50," ENTER DATA OF LAST MATCH");<br />settextstyle(0,0,1);<br />cout<<"nnntt Runs: ";<br />cin>>r1;<br />if(r1>100)<br />cen++;<br />if(r1>50&&r1<100)<br /> hcen++;<br />runs+=r1;<br />cout<<"ntt Wickets: ";<br />cin>>w1;<br />wic+=w1;<br />mat++;<br />cout<<"ntt OUT/NOTOUT(y/n): ";<br />char ch=getche();<br />if(ch=='y')<br />innings++;<br />cout<<"ntt Overs Bowled :";<br />cin>>o1;<br />overs+=o1;<br />cout<<"ntt Balls Performed";<br />cin>>b1;<br />balls+=b1;<br />if(hiscr<r1)<br />hiscr=r1;<br />if(bbol<w1)<br />bbol=w1;<br />}<br />/*------------------------------------- enjoyable for displaying the information -------------*/<br />void participant::showdata()<br />{<br />int x=50;<br />char str[20];<br />cleardevice();<br />rectangle(50,150,610,250);<br />line(50,200,610,200);<br />for(int i=0;i<6;i++)<br /> {<br />x+=80;<br />line(x,150,x,250);<br />}<br />outtextxy( 60,170,"MATCHS");<br />outtextxy(140,170,"RUNS");<br />outtextxy(220,170,"WICKETS");<br />outtextxy(300,170,"AVG(BAT)");<br />outtextxy(380,170,"AVG(BOL)");<br />outtextxy(460,170,"100`s");<br />outtextxy(540,170,"50`s");<br />outtextxy( 50,280,"BEST PERFORMANCE IN A MATCH ::");<br />outtextxy( 50,300,"RUNS : ");<br />outtextxy( 50,320,"WICKETS :");<br />sprintf(str,"%d",mat);<br />outtextxy(60,220,str);<br />sprintf(str,"%d",runs);<br />outtextxy(140,220,str);<br />sprintf(str,"%d",wic);<br />outtextxy(220,220,str);<br />sprintf(str,"%f",btavg);<br />outtextxy(300,220,str);<br />sprintf(str,"%f",blavg);<br />outtextxy(380,220,str);<br />sprintf(str,"%d",cen);<br />outtextxy(460,220,str);<br />sprintf(str,"%d",hcen);<br />outtextxy(540,220,str);<br />settextstyle(1,0,1);<br />sprintf(str,"%s",nation);<br />outtextxy(50,110,str);<br />sprintf(str,"%s",title);<br />outtextxy(50,90,str);<br />settextstyle(0,0,1);<br />sprintf(str,"%d",hiscr);<br />outtextxy(130,300,str);<br />sprintf(str,"%d",bbol);<br />outtextxy(130,320,str);<br />getch();<br />}<br />fstream file,file1,tfile,tfile1;<br />int ch1;<br />/*----------------------------- fundamental ---------------------*/<br />void fundamental()<br />{<br />participant p;<br />clrscr();<br />int ch,i=0,gm,gd=DETECT;<br />char st[10];<br />int x,y;<br />x=100;<br />y=100;</p><br/><p>initgraph(&gd,&gm,"g:tcbgi");<br />char pname[10],cname[10],password[10]="",c;<br />setbkcolor(BLUE);<br />whereas(!kbhit())<br />{</p><br/><p>settextstyle(1,0,6);<br />outtextxy(150,200,"CRICKETER`S");<br />outtextxy(170,270,"DATABASE");<br />}<br />settextstyle(0,0,1);<br />cleardevice();<br />setcolor(11);<br />settextstyle(1,0,1);<br />outtextxy(100,380,"LOADING...");</p><br/><p>for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />if(i<400&&i>370)<br />delay(40);<br />delay(10);<br />}<br />settextstyle(0,0,1);<br />cleardevice();<br />getch();<br />//cleardevice();<br />/*------------------ beginning menu -------*/<br />int tag;<br />tag:<br />cleardevice();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ONE DAY") ;<br />outtextxy(200,130," 2 :: TEST") ;<br />//cin>>ch1;</p><br/><p>ch1=getche();<br />ch1=ch1-'0';<br />settextstyle(0,0,1);<br />if(ch1==1)<br />{<br />do<br />{<br />cleardevice();<br />//p.menu();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ADD RECORDS ") ;<br />outtextxy(200,130," 2 :: MODIFY RECORDS ") ;<br />outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;<br />outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;<br />outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;<br />outtextxy(200,250," 6 :: BACK") ;<br />outtextxy(200,280," 7 :: EXIT") ;<br />//cin>>ch;<br />ch=getche();<br />ch=ch-'0';</p><br/><p>settextstyle(0,0,1);</p><br/><p>swap(ch)<br />{<br />/*----- ODI insert ----------*/<br />case 1:</p><br/><p>cleardevice();<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::finish);<br />p.getdata();<br />p.calculation();<br />file.write((char*)&p,sizeof(p));<br />file.clear();<br />file.shut();<br />c=getch();<br />break;<br />/*------- ODI title clever search -------------*/</p><br/><p>case 3:</p><br/><p>cleardevice();<br />cout<<"ntt Identify For Search: ";<br />will get(pname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />//if(i>250&&i<300)<br /> // delay(40);</p><br/><p>delay(10);<br />}<br />cleardevice();<br />int flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />break;<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;</p><br/><p>/*-------------- ODI modification --------------*/<br />case 2:</p><br/><p>cleardevice();<br />cout<<"nttENTER PASSWORD ";<br />int i=0;<br />whereas(i<6)<br /> {<br />password[i]=getche();<br />cout<<"*";<br />i++;<br />}<br />getch();<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LO ADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();</p><br/><p>if(!strcmp("vineet",password))<br />{<br />cout<<"ntt Identify For Modification ";<br />will get(pname);<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file1.open("temp1.txt",ios::in|ios::out|ios::ate);<br />if(!tfile1)<br />cout<<"nerror";<br />file1.seekp(0,ios::beg);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{</p><br/><p>if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />p.replace();<br />p.calculation();<br />file1.write((char*)&p,sizeof(p));<br />}<br />else<br />{<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />}<br />file.clear();<br />file.shut();<br />file1.clear();<br />file1.shut();<br />if(flag==1)<br />{<br />take away("ODI.txt");<br />rename("temp1.txt","ODI.txt");</p><br/><p>}<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />}<br />else<br />cout<<"ntt Improper Password";<br />c=getch();<br />break;</p><br/><p>/*------------ ODI nation clever search --------------*/<br />case 4:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />//if(i>333&&i<400)<br /> // delay(40);<br />}<br />cleardevice();<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />/*------ ODI record of gamers ------------*/<br />case 5:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />}<br />cleardevice();<br />flag=0;<br />file.open("ODI.txt",ios::in|ios::out|ios::ate);<br />file.seekp(0,ios::beg);<br />whereas(file.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />settextstyle(1,0,1);<br />//cout<<"nntt"< <p.title;</p><br/><p>sprintf(st,"%s",p.title);<br />outtextxy(x,y,st);<br />y=y+30;<br />settextstyle(0,0,1);<br />}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered"; </p><br/><p>//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />case 6:<br />goto tag;<br />//break;</p><br/><p>case 7:<br />exit(0);<br />break;<br />}<br />}whereas(1);<br />}<br />if(ch1==2)<br />{<br />do<br />{<br />cleardevice();<br />//p.menu();<br />settextstyle(1,0,2);<br />outtextxy(200,100," 1 :: ADD RECORDS ") ;<br />outtextxy(200,130," 2 :: MODIFY RECORDS ") ;<br />outtextxy(200,160," 3 :: SEARCH RECORD (NAME)") ;<br />outtextxy(200,190," 4 :: SEARCH RECORD (COUNTRY)") ;<br />outtextxy(200,220," 5 :: LIST OF PLAYER OF ONE COUNTRY") ;<br />outtextxy(200,250," 6 :: BACK") ;<br />outtextxy(200,280," 7 :: EXIT") ;<br />//cin>>ch;<br />ch=getche();<br />ch=ch-'0';</p><br/><p>settextstyle(0,0,1);</p><br/><p>swap(ch)<br />{<br />/*------------------ TEST insert ------------------*/<br />case 1:<br />cleardevice();<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::finish);<br />p.getdata();<br />p.calculation();<br />tfile.write((char*)&p,sizeof(p));<br />tfile.clear();<br />tfile.shut();<br />break;<br />/*------------------ TEST title clever search ------------------*/<br />case 3:<br />cleardevice();<br />cout<<"ntt Identify For Search: ";<br />will get(pname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />int flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />break;<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />c=getch();<br />break;<br />/*------------------ TEST modification ------------*/<br />case 2:<br />cleardevice();<br />cout<<"nttENTER PASSWORD";<br />int i=0;<br />whereas(i<6)<br /> {<br />password[i]=getche();<br />cout<<"*";<br />i++;<br />}<br />getch();<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();</p><br/><p>if(!strcmp("vineet",password))<br />{<br />cout<<"ntt Identify For Modification ";<br />will get(pname);<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile1.open("temp1.txt",ios::in|ios::out|ios::ate);<br />if(!tfile1)<br />cout<<"nerror";<br />tfile1.seekp(0,ios::beg);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{</p><br/><p>if(!strcmp(p.title,pname))<br />{<br />flag=1;<br />cout<<"ntt Enter Information For First Inning: ";<br />p.replace();<br />cout<<"ntt Enter Information For Second Inning: ";<br />p.replace();<br />p.mat--;<br />p.calculation();<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />else<br />{<br />tfile1.write((char*)&p,sizeof(p));<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />tfile1.clear();<br />tfile1.shut();<br />if(flag==1)<br />{<br />take away("TEST.txt");<br />rename("temp1.txt","TEST.txt");</p><br/><p>}<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />}<br />else<br />cout<<"ntt Improper Password";<br />c=getch();<br />break;<br />/*------------------ TEST nation clever search -------*/<br />case 4:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />cout<<"nn";<br />p.showdata();<br />}<br />}<br />tfile.clear();<br />tfile.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />break;<br />/*------------------ TEST record --------*/<br />case 5:<br />cleardevice();<br />cout<<"ntt Nation`s Identify For Search: ";<br />will get(cname);<br />cleardevice();<br />setcolor(10);<br />outtextxy(100,380,"LOADING...");<br />for(i=0;i<401;i++)<br /> {<br />outtextxy(100+i,400,"#");<br />delay(10);<br />if(i>350&&i<400)<br /> delay(40);<br />}<br />cleardevice();<br />flag=0;<br />tfile.open("TEST.txt",ios::in|ios::out|ios::ate);<br />tfile.seekp(0,ios::beg);<br />whereas(tfile.learn((char*)&p,sizeof(p)))<br />{<br />if(!strcmp(p.nation,cname))<br />{<br />flag=1;<br />settextstyle(1,0,1);<br />//cout<<"nntt"< <p.title;</p><br/><p>sprintf(st,"%s",p.title);<br />outtextxy(x,y,st);<br />y=y+30;<br />settextstyle(0,0,1);<br />//cout<<"nntt"< <p.title;<br /> </p><br/><p>}<br />}<br />file.clear();<br />file.shut();<br />if(flag==0)<br />cout<<"ntt Report Not Discovered";<br />//char c;<br />//cout<<"nntt Enter Any Key To Cont.";<br />//cin>>c;<br />c=getch();<br />break;<br />case 6:<br />goto tag;<br />case 7:<br />exit(0);<br />break;<br />}<br />}whereas(1);<br />}<br />}<br />/* ------------------------------end of fundamental ----------*/ </p><br/></div><br/></div> |
Supply projectgeek.com