In Old Friends we will be revisiting three of your unit 1 programs: hello, fahrenheit and pennies.
You may use your own code from unit 1, or download code as indicated in the program spec. (The section labeled “Well Distributed” will walk you through this.) The interesting thing about downloading their code is that you may want to see what elegant, well structured code looks like. You will notice in pennies.c, the programmer used #define MAX_DAYS 31 and #define MIN_DAYS 28 to define two constants, rather than hard coding these in the program. We haven’t talked about this in class, but it is an excellent way to develop programs, so that if you ever have to change one of these “constants” you can do it in one place rather than many places throughout your code.
You will be modifying these three programs to accept what is called command line arguments as input to each program. This means instead of typing in ./fahrenheit and then prompting for input within the program, you will supply input at the time you run it, as in ./fahrenheit 50, meaning to accept 50 degrees as your input. Be sure to watch the video imbedded in the program spec to learn how to do this.
Also note that the spec talks about using an exit code (return 1;) to indicate that the program finished running but not successfully. You will use this when the user runs your program but does not supply the correct number of arguments. You will not re-prompt.