Sofi
2010-02-12 19:51:39 UTC
I just want help to fix my incorrect display, and not rewrite the program unless I'm doing something really really wrong...
note: calculateTemperature is a subfunction of the function conversionCalculations. There are to be more subfunctions under conversions but I'm working on this first. Also program is meant to be overmodulized on purpose.
----------------------
# include
void userInput (int* fahrenheit);
int conversions (void);
float calculateTemperature (int fahrenheit);
void display (int temperature, int celsius, int kelvin);
int main (void)
{
int fahrenheit;
int celsius, kelvin;
conversions( );
userInput(&fahrenheit);
display (fahrenheit, celsius, kelvin);
return 0;
}
void userInput (int* fahrenheit)
{
printf("\nEnter Fahrenheit temperature (integer) ");
scanf("%d", fahrenheit);
return;
}
int conversions (void)
{
float celsius, kelvin;
return;
}
float calculateTemperature (int fahrenheit)
{
float celsius, kelvin;
celsius = (fahrenheit - 32)/1.8;
kelvin = celsius + 273.15;
return;
}
void display (int fahrenheit, int celsius, int kelvin)
{
printf("\n%10s%5d", "Fahrenheit", fahrenheit);
printf("%10s%5.2f", "Celsius", celsius);
printf("%10s%5.2f", "Kelvin", kelvin);
printf("\n\n");
return;
}
---------------------