#include<iostream.h>
#include<conio.h>
int n,r,ch;
int tar,n1,r1;
float rr,o,rrr;
float runrate()
{
cout<<"ENTER THE NUMBER OF BALLS:\n";
cin>>r;
cout<<"ENTER THE RUNS\n";
cin>>n;
o=r/6;
rr=n/o;
return rr;
}
void main()
{
clrscr();
cout<<"\nPRESS->1:TO CALULATE RUNRATE\n2->TO CALCULATE REQUIRED RUNRATE PER OVER TO WIN\n";
cin>>ch;
switch(ch)
{
case 1:runrate();
cout<<"RUN RATE="<<rr<<"/over"<<"\n";
case 2:cout<<"ENTER THE TARGET TO WIN:\n";
cin>>tar;
cout<<"ENTER THE CURRENT STATUS OF MATCH->\nRUNS AND OVERS:\n";
cin>>n>>r;
n1=tar-n;
r1=300-180;
if(r1<0)
cout<<"MATCH IS OVER NO REQUIRED RATE RATE\n";
else
rrr=n1/(r1/6);
cout<<"REQUIRED RUNRATE IS:\n"<<rrr;
}
getch();
}
This is c++ code
ReplyDeleteBut why have you used R1=300-180
ReplyDelete