Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copy your temperature.c file to a file called temptbl.c. Add another function to the file: int temptable(float start, float stop); /* Given: starting and ending

Copy your temperature.c file to a file called temptbl.c. Add another function to the file:

 int temptable(float start, float stop); /* Given: starting and ending temperatures in degrees Fahrenheit The function prints a table of conversions from degrees Fahrenheit to degrees Celsius from start to at most stop in five degree F increments, one conversion per line. Returns: the number of table lines printed. */ 

The function, temptable(), should use your function, tocelsius(). Modify the driver, main(), to prompt the user to enter the start and stop temperatures and print the table, until the user enters the same value for start and stop. HOWEVER; before you write ANY code for this program, you should begin by writing the algorithms for the function temptable() and the driver main() IN WORDS. You should write these algorithms in a text file called algorithms, which you WILL turn in for this lab (worth 2 points). You can then use the steps in your algorithm as comments in your source code file.

#include int main()

{ int fahrenheit;

double celsius;

int temptable(float start, float stop); /* Given: starting and ending temperatures in degrees Fahrenheit

The function prints a table of conversions from degrees Fahrenheit to degrees Celsius from start to at most stop in five degree F increments, one conversion per line.

Returns: the number of table lines printed. */

printf("Enter temperature value in Fahrenheit: ");

//Reading the Fahrenheit value inputted by user scanf("%d", & fahrenheit);

//Conveerting the temperature from Fahrenheit to Celsius celsius = (fahrenheit - 32) * 0.5556;

// Displaying the Celsius value printf("Converted Celsius value: %f ", celsius);

while(fahrenheit >= -499)

{ printf("Enter temperature value in Fahrenheit: ");

//Reading the Fahrenheit value inputted by user scanf("%d", & fahrenheit);

//Conveerting the temperature from Fahrenheit to Celsius celsius = (fahrenheit - 32) * 0.5556;

// Displaying the Celsius value printf("Converted Celsius value: %f ", celsius); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

2. What are your challenges in the creative process?

Answered: 1 week ago