next up previous
Next: Make your code into Up: Programming assignment Previous: Print ordinal numbers

Print the date

1.
At the beginning of main, add the following two lines:
          int day = 13;
          int month = 7;

2.
Use the code from the previous section to print ``The 13th day of the 7th month.'' Of course, you have to write it so that it will work for any day of the month and any month.

FOOD FOR THOUGHT: To do this part, you probably had to make two copies of a really complicated if statement. I hope you had it completely debugged, because now if you have to make any changes, you will have to make them in two places.

What if we wanted to print ``The 2nd minute of the 13th hour of the 7th day of the 11th month of the 1998th year?'' What would your code look like then?



Allen B. Downey
2/18/1998