1. function program help

I had to do this program which calculates wind chill factor for my homework.
2 Problems:
-the answer is supposed to have 4 numbers after the decimal but it is just coming out as an integer with no decimal points even though I used setprecision(4)?
-the answer i am getting is not what the prof's answer was on our handout...
W= 33 – ((10√v – v + 10.5)(33-t))/23.1
is the equation, where w is the windchill factor, v is wind speed and t is temperature...did I write it correctly in the code?
Thanks a bunch.

Code:
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
#include <cmath>
#include <iomanip>
using std::fixed;
using std::setprecision;
int windchill(double, double);
int main()
{
double wind, temp;
cout<<"Please enter the wind speed: ";
cin>>wind;
cin>>temp;
while (temp>10)
{
cout<<"The temperature should be less than 10.  Try again: ";
cin>>temp;
}
cout<<"The wind chill index is "<<setprecision(4)<<fixed<<windchill(wind,temp)<<endl;
return 0;
}
int windchill(double v, double t)
{
int w;
w=33-(((10*sqrt(v)-v+10.5)*(33-t))/23.1)<<endl;
return w;
} 2. Make your function return double rather than int perhaps? 3. Hmm when I do that 2 error messages come up..  4. when you changed the return type did you also change it in the function prototype? also change w to double, or better yet, get rid of it and just: return (33-(((10*sqrt(v)-v+10.5)*(33-t))/23.1)) 5. excellent -- it works now!! thanks  Popular pages Recent additions 