It's because the literal value (25.95) that you are passing into your call to the function VAR1 is automatically treated as a double, but your function takes a float as a parameter. So you're getting a warning about it.
If you pass the variable like this:
printf("%.2f", VAR1(25.95f)); // printf a float ending in .95
The f at the end of the literal value will ensure that the value is treated as a float and not a double and should stop the warning from occurring.
in fact considering this is C++ you should really be using std::cout instead of printf in line 15 too! :
cout << setprecision(.2) << VAR1(25.95f);
Note: in order to use setprecision with cout, you also need to include iomanip after iostream..:
So after you've included iostream, add the following:
Cheers for now,
Jas.
Last edited by JasonHippy; Nov 9th, 2009 at 9:57 am.
Reputation Points: 590
Solved Threads: 123
Practically a Master Poster
Offline 672 posts
since Jan 2009