## Function division problem. Need HELP!!

hello im hoping i can receive some insight on my current problem i was required to write a program that takes a baseball players statistics and displays there averages. i was required to make 3 function in the file to perform this tasks. my problem i am having a division problem in the SLG function and for the life of me cannot figure out what i have done wrong the two functions above it are working flawlessly. i hope one of you can help me out thank you.My compiler does not require the system ("PAUSE"); command.
OUTPUT
The player's batting average is: 0.347
The player's on-base percentage is: 0.375
The player's slugging percentage is:
(test)AB = 101
(test)Tot Base = 58
0.000

Code:
```/* Batting Average Program
file:  batavg1CPP.cpp

Glossary of abbreviations:

BA = batting average
PA = plate appearances
H = hits
BB = bases on balls (walks)
HBP = times hit by pitch
S = sacrifices
AB = at bats
_1B = singles
_2B = doubles
_3B = triples
HR = home runs

*/

#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<cmath>

//function prototypes
double BA(int PA, int _1B, int _2B, int _3B, int HR, int S, int BB, int HBP);
double OBP(int PA, int _1B, int _2B, int _3B, int HR, int BB, int HBP);
double SLG(int PA, int _1B, int _2B, int _3B, int HR, int S, int BB, int HBP);

using namespace std;

int main ()
{
int _1B, _2B, _3B, HR, PA, BB, HBP, S;

/*In this example the actual parameter names match the formal parameter names.
This doesn't have to be the case */

cout<<"Enter a player's plate appearances: ";
cin>>PA;

cout<<endl;

cout<<"Enter the number of singles: ";
cin>>_1B;

cout<<endl;

cout<<"Enter the number of doubles: ";
cin>>_2B;

cout<<endl;

cout<<"Enter the number of triples: ";
cin>>_3B;

cout<<endl;

cout<<"Enter the number of home runs: ";
cin>>HR;

cout<<endl;

cout<<"Enter the number of sacrifices: ";
cin>>S;

cout<<endl;

cout<<"Enter the number of walks: ";
cin>>BB;

cout<<endl;

cout<<"Enter the number of times hit by pitch: ";
cin>>HBP;

cout<<endl;

cout<<fixed<<setprecision(3)<<"The player's batting average is: "
<<BA(PA, _1B, _2B, _3B, HR, S, BB, HBP)<<endl
<<"The player's on-base percentage is: "
<<OBP( PA, _1B, _2B, _3B, HR, BB, HBP)<<endl
<<"The player's slugging percentage is: "
<<SLG( PA, _1B, _2B, _3B, HR, S, BB, HBP)<<endl;

cout<<endl<<endl;

return 0;
}

/*----------------------------------------------------------------------------*/

double BA(int PA, int _1B, int _2B, int _3B, int HR, int S,
int BB, int HBP)
{
int AB, H;
double avg;
H = _1B + _2B + _3B + HR;
AB = PA - (BB + HBP + S);
avg = static_cast<double>(H)/AB;
return avg;
}

double OBP(int PA, int _1B, int _2B, int _3B, int HR, int BB, int HBP)
{
int H;
double OBP;
H = _1B + _2B + _3B + HR;
OBP = (H + BB + HBP) / static_cast<double>(PA);
return OBP;
}

double SLG(int PA, int _1B, int _2B, int _3B, int HR, int S, int BB, int HBP)
{
int Tot_base, AB, SLG, x;
AB = PA - (BB + HBP + S);
cout<<endl<<"AB = "<< AB <<endl;     // error testing
Tot_base = (HR*4)+(_3B*3)+(_2B*2)+_1B;
cout<<"Tot Base = "<<Tot_base <<endl;// error testing
SLG = static_cast<double>(Tot_base) / AB;
return SLG;
}```