Try changing your code to:
Floats are Standard C/C++ datatypes so I dont see why a compiler will not support them. Thats a bunch of crap I tell you. Anyways, the only float bug I know of is:PHP Code:#include <stdio.h>
int main()
{
int miles =0, totalMiles =0, gallons =0, totalGallons =0;
float overallAverage =0, temp =0;
do {
printf( "Enter the gallons used (-1 to end): " );
scanf( "%d", &gallons);
printf( "Enter the miles driven: " );
scanf( "%d", &miles );
totalMiles += miles;
totalGallons += gallons;
if ( miles != 0 && gallons != 0 ) {
temp = ( float ) miles / gallons;
printf( "The miles / gallon for this tank was %.2f \n\n", temp);
}
} while( gallons != -1 );
overallAverage = ( float ) totalMiles / totalGallons;
printf( "\nTHe overall average miles/gallon was %.2f", overallAverage );
return 0;
}
-MoMadPHP Code:float x = 3F, y = 3.0F;
printf("X/Y = %f\n", (float) x / y );
// Might not output 1 because of rounding errors




:MoMad:
Reply With Quote