Be sure you have read (or at least skimmed) the assigned readings from chapter 4, and section 9 (about recursion) from chapter 6.
Do the following programming problems. You will end up with at least one code file per problem. Submit your program source (and any other needed files) by sending mail to bmassing@cs.trinity.edu with each file as an attachment. Please use a subject line that mentions the course and the assignment (e.g., ``csci 1312 hw 4'' or ``CS1 hw 4''). You can develop your programs on any system that provides the needed functionality, but I will test them on one of the department's Linux machines, so you should probably make sure they work in that environment before turning them in.
double f_to_c(double f);where the single parameter f represents a Fahrenheit temperature and the return value represents the equivalent Celsius temperature. (So, for example, f_to_c(32.0) should evaluate to 0.0.)
void convert_and_print(double f);that calls the conversion function and prints its input and output nicely. So for example convert_and_print(32.0); might print
32 degrees Fahrenheit is 0 degrees Celsius(Don't worry too much about printing appropriate numbers of digits after the decimal point; you can do whatever is easy, or read the man page or other documentation for printf to find out how to get more control.)
NOTE that the point of this problem is for you to practice defining and using functions, so you will not get full credit unless your program includes functions as described.
Euclid's algorithm can be described recursively thus: For non-negative integers and , not both zero, with ,
NOTE that the point of this problem is for you to practice defining and using a recursive function, so you will not get full credit unless you do. I recommend putting all the error checking in the main program and having a recursive function declared as
int gcd(int a, int b);
NOTE that the point of this problem is for you to practice defining and using a recursive function, so you will not get full credit unless you do. I recommend putting all the error checking in the main program and having a recursive function declared as
void count(int start, int end, int incr);
Include the Honor Code pledge or just the word ``pledged'', plus at least one of the following about collaboration and help (as many as apply).1Text in italics is explanatory or something for you to fill in. For programming assignments, this should go in the body of the e-mail or in a plain-text file honor-code.txt (no word-processor files please).
Include a brief essay (a sentence or two is fine, though you can write as much as you like) telling me what about the assignment you found interesting, difficult, or otherwise noteworthy. For programming assignments, it should go in the body of the e-mail or in a plain-text file essay.txt (no word-processor files please).