*WRITE A .H FILE IN C PROGRAM* Write a program that converts a user entered temp
ID: 3682148 • Letter: #
Question
*WRITE A .H FILE IN C PROGRAM*
Write a program that converts a user entered temperature in Fahrenheit to Celsius incorporating three modules and functions named as identified below. The user entered Fahrenheit temperature is to be passed as an argument to the function named convert() in the module "conversion.c". The calculated Celsius value is to be return by the function and the result displayed to the user in the function main() :
convert_driver.c - contains the function main() and the user interface
conversion.h - contains the prototype for a function named convert()
convertsion.c - contains the function definition for convert()
Explanation / Answer
/*Convert_driver.c*/
#include “Conversion.h”
#include <stdio.h>
float faren,fare;
main()
{
printf(“Enter Farenheit value ”);
scanf(“%f”,&faren);
fare=Conversion(faren);
printf(“The Celsius value=%f”, fare);
}
/*Conversion.c*/
extern float *faren;
float Conversion(fa)
float *f1;
float cel;
{
float convert(f1)
{
cel=5/9*(f1-32);
return(cel);
}}
/*Conversion.h*/
#define f2
float Conversion();
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.