0

```
//function example
#include <iostream>
#include <cmath>
using namespace std;
float cutoff(float& windchill)
{
int z;
z = (int)(windchill + 0.5);
return(z);
}
float calculate (int& t, int& v)
{
float windchill;
windchill = 35.74 + (0.6215 * t) - 35.75 * pow(v,0.16) + 0.4275 * t * pow(v,0.16);
return(windchill);
}
void input (int& temp, int& windspeed)
{
cout << "Enter the temperature: ";
cin >> temp;
cout << "\nEnter the windspeed: ";
cin >> windspeed;
}
int main ()
{
int temp, windspeed, z;
float windchill;
input(temp, windspeed);
cout << "\nTemp is: " << temp << "\nWindspeed is: " << windspeed;
calculate(temp,windspeed);
cout << "\n\nWindchill is: " << cutoff(windchill) << endl << endl;
return 0;
}
```

I need some help figuring out why when 'windchill' is returned to main Im getting the value "-1.07374e+008". When I want to just add 0.5 and truncate the decimal. Its doing this for anything I enter

Thanks,

Jordan

Edit: yes, I realize I spelled rounding wrong :p

*Edited 6 Years Ago by JHus00*: n/a