subject

Program in C: In this program you will be converting measurements from one unit to another.

Restrictions

No global variables may be used
Your main function may only declare variables and call other functions
Temperatures

FromFarenheitCelsiusKelvin
Farenheit(F)F(F - 32) * 5/9(F-32)*5/9+273.15
Celsius(C(C * 9/5) +32CC + 273.15
Kelvin(K)(K - 273.15) * 9/5 + 32K -273.15K
Distances

FromInchesFeetYardsMiles
Inches(I)II / 12I / 36I / 63360
Feet(F)F * 12FF / 3F / 5280
Yards(Y)Y* 36Y * 3YY / 1760
Miles(M)M * 63360M * 5280M * 1760M
Requirements

Users should be able to enter both upper and lower case letters for units
Any amount of white space should be allowed inputs
The program must compile with both -Wall and -Werror options enabled
Submit only the files requested
Use doubles to store real numbers
Print all doubles to 2 decimal points unless stated otherwise
Assumptions

Input is NOT guaranteed to be valid
If invalid input is received, your program should report it and terminate
Wait until we cover how to handle invalid input in class before dealing with this part of the problem
Tips

This problem is very large and you will want to break it down into many functions to help manage complexity
When reading in a character don't forget to put a space in front of the %c in scanf
You can save yourself a bit of work by always converting to a common unit and then converting to the desired unit
For example, always converting yards first and then from yards to the desired unit
The exit function in stdlib. h can be very helpful for ending a program early. If you use it make sure to do exit(0)
Examples

Example 1

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 0K
Enter the new unit type (F, C, or K): C
0.00K is -273.15C

Example 2

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: d
Enter the distance followed by its suffix (I, F,Y, M): 5 y
Enter the new unit type (I, F,Y, M): i
5.00Y is 180.00I

Example 3

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: J
Unknown conversion type J chosen. Ending program.

Example 4

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: 10
Invalid formatting. Ending program.

Example 5

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 42 G
G is not a valid temperature type. Ending program.

Example 6

Pick the type of conversion that you would like to do.
T or t for temperature
D or d for distance
Enter your choice: t
Enter the temperature followed by its suffix (F, C, or K): 420 Blaze It
Invalid formatting. Ending program.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:00
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
question
Computers and Technology, 24.06.2019 10:10
Scanning the road can be thought of as a
Answers: 2
question
Computers and Technology, 24.06.2019 15:30
What is the function of compilers and interpreters? how does a compiler differ from an interpreter?
Answers: 2
You know the right answer?
Program in C: In this program you will be converting measurements from one unit to another.
<...
Questions
question
Mathematics, 08.12.2020 20:50
question
English, 08.12.2020 20:50
question
Mathematics, 08.12.2020 20:50
question
Mathematics, 08.12.2020 20:50