1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
float getera(int rs, float i)
{
float er;
if (i==0)
{
er=0;
}
else er=(rs*9)/i;
return er;
}
bool checkip(double fpt)
{
double ipt,fcpt,param;
bool error=false;
param=fpt;
fcpt = modf (param , &ipt);
if ((fcpt < .0) || (fcpt >=.21))
{
error=true;
}
else
{
error=false;
}
return error;
}
float calcip(double fpt)
{
double ipt,fcpt,param;
param=fpt;
fcpt = modf (param , &ipt);
if ((fcpt > .0) && (fcpt <=.1))
{
param=ipt+.3333;
fpt=param;
}
else
if ((fcpt >.1) &&(fcpt <.21))
{
param=ipt+.6666;
fpt=param;
}
else
{
param=ipt+.0000;
fpt=param;
}
return fpt;
}
float calcbavg(int hit,int ab)
{
float ba;
if (ab==0)
{
ba=0;
}
else ba=float(hit)/float(ab);
return ba;
}
int calctotal_bases(int s,int d,int t,int hr)
{
int tb;
tb=s+(d*2)+(t*3)+(hr*4);
return tb;
}
int getnumsingles(int h,int d,int t,int hr)
{
int s;
s=h-(d+t+hr);
return s;
}
int calctotal_hits(int s,int d,int t, int hr)
{
int th;
th=s+d+t+hr;
return th;
}
float calc_slugper(int ab, int tb)
{
float sp;
if (ab==0)
{
sp=0;
}
else sp=float(tb)/float(ab);
return sp;
}
float calc_sbper(int sb, int t_sba)
{
float sper;
if (t_sba==0)
{
sper=0;
}
else
{
sper=float(sb)/float(t_sba);
}
return sper;
}
int calc_totsba(int sb, int cs)
{
int tsb;
tsb=sb+cs;
return tsb;
}
float calcsbruns(int sb, int cs)
{
float sbr;
sbr=float((.3*sb))- float((.6*cs));
if (sbr<0) sbr=0;
return sbr;
}
float calcsoratio(int k, int ab)
{
float kr;
if (k==0 ||ab==0)
{
kr=0;
}
else
{
kr=float(k)/float(ab);
}
return kr;
}
float calcobp(int th,int bb,int hp,int ab,int sf)
{
float obp;
if (ab+bb+hp+sf==0)
{
obp=0;
}
else obp=float((th+bb+hp))/float((ab+bb+hp+sf));
return obp;
}
float calcrunscre(float obp,int tb)
{
float rc;
rc=obp*tb;
return rc;
}
int getpa(int ab,int bb,int hp,int sh,int sf,int di)
{
int pa;
pa=ab+bb+hp+sh+sf+di;
return pa;
}
float calcobpslug(float obp,float slgp)
{
float obps;
obps=obp+slgp;
return obps;
}
float calcisop(int tb,int ab,int th)
{
float isp;
if (ab==0)
{
isp=0;
}
else isp=(tb-th)/ab;
return isp;
}
float calcwhip(float ha,float wa,float ip)
{
float wi;
wi=(ha+wa)/ip;
return ip;
}
float calcwinper(int w,int l)
{
float wp;
int twl;
twl=w+l;
if (twl==0)
{
wp=0;
}
else wp=float(w)/float(twl);
return wp;
}
|