A C program to convert Celsius to Fahrenheit
Program (code.c) & (codev2.c) to convert Fahrenheit to Celsius. Simplistic, DOS based so that I may digest and learn.
Program 1: Ask the user to input a Fahrenheit temperature, as a decimal number. Make clear what the user should enter, for example, "enter a whole number" or "please use the format xxx.xx.". Get the temperature from the user as a float. Calc, convert the temperature to Centigrade. Finally, display the two temperatures. Remember to format floats. The client offered that the algorithm for conversion is, "Centigrade is 5/9ths Fahrenheit minus 32". Results are rounded down (the remainder is ignored).
Program 2: Implements a switch: Offer the user three choices, obtains the choice and display an action based on that choice. One of the actions will include an if..else. Also include a default for incorrect choices.
Layout the planned structure and steps to accomplish the individual programs. Ensure brief, accurate and complete detailed instructions in the form of pseudocode, not code. Construct two brief explanations for the pseudocode. Provide both programs, pseudocode, and code (code in editable text).
This solution provides a detailed C program that converts Celsius to Fahrenheit. It also provides an example of how to use the switch statement in C. For each of the programs included in this solution there is a detailed explanation of how the program works, a pseudo-code description, and the actual C program source code.
This answer includes:
- Plain text
- Cited sources when necessary
- Attached file(s)
Active since 2007