[prev] 33 [next]

Exercise 1: Displaying Months

Write a function monthName(int) that
  • accepts a month number 1=Jan ... 12=Dec
  • returns a string containing the month name
  • assume that the string will be read-only
  • use a switch to decide on the month
Suggest an alternative approach using an array.