Int to Decimals

Hey everybody. I can't seem to find a way to get my array to display decimal places instead of the int value
hits[] is int
atbats[] is int
walks[] is int
and batavgs[] is a double

1
2
3
4
5
6
7
8
void calcbatavg()
{
	for(int index=0;index<MAXPLAYER;index++)
		{
			batavgs[index]=((hits[index])/(atbats[index]-walks[index]));
			cout<<setprecision (3)<<batavgs[index];
		}
}


Any help is much appreciated.
Topic archived. No new replies allowed.