For this assignment, you will write a program called rt.c
that does
two wildly unconnected things: show the most popular religions and
convert temperatures from Fahrenheit to Celsius.
(Some religions have hot & cold places—perhaps that connects the two.)
                
Here are the ten most popular religions in the world, according to Wikipedia:                 
index | Religion | Popularity |
---|---|---|
1 | Christianity | 31.2% |
2 | Islam | 24.1% |
3 | Secular/Nonreligious/Agnostic/Atheist | 16% |
4 | Hinduism | 15.1% |
5 | Buddhism | 6.9% |
6 | Chinese traditional religion | 5.50% |
7 | Ethnic religions | 4.19% |
8 | African traditional religions | 1.40% |
9 | Sikhism | 0.32% |
10 | Spiritism | 0.21% |
“%” is the prompt and not a part of your program. Your input looks like this. Your output should match exactly.                 
% c11 -Wall rt.c % ./a.out q: quit h: help r: info about a religion t: temperature conversion Command: t Fahrenheit: 212 212.000000 Fahrenheit is 100.000000 Celsius Command: t Fahrenheit: 68.5 68.500000 Fahrenheit is 20.277778 Celsius Command: z Invalid command Command: h q: quit h: help r: info about a religion t: temperature conversion Command: r Which religion? 5 Buddhism: 6.9% Command: r Which religion? 3 Secular/Nonreligious/Agnostic/Atheist: 16% Command: r Which religion? 100 Don't know anything about religion #100. Command: r Which religion? 6 Chinese traditional religion: 5.50% Command: t Fahrenheit: 65.5 65.500000 Fahrenheit is 18.611111 Celsius Command: q
You must define and use the following functions:                 
void print_menu();
void religion(int);
religion(5)
would display information about Buddhism.
If the number is out of range, display as shown in the sample run.
double celsius(double);
Note the difference between displaying something and returning
something. celsius
must not call printf
.
None of the required functions should call scanf
.
                
If you encounter “STACK FRAME LINK OVERFLOW”, then try this:
export STACK_FRAME_LINK_OVERRIDE=ffff-ad921d60486366258809553a3db49a4a
Use web checkin, or:                 
~cs156/bin/checkin HW3 rt.c
Follow the directions on the homework page.                 
Turn in someone else’s work.                 
User: Guest