Create a program that draws a monthly calendar in the form of a table.
The input consists of two lines, each terminated by a newline character. The first line contains the number of days (an integer between 28 and 31). The second line contains one of the following words: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, or Sunday, describing the first day of the month.
The output is a table containing the day numbers within the month. Each row of the table represents a week, so they have 7 cells. The cells are separated by a single tab character. Each cell is two characters wide containing the right-aligned number of the day or two dots when the cell belongs to another month.
Output for Sample Input
Hints and Guide
The two lines of the input contain information of different types. The first line consists of a number, the second contains a word from a given set. Because we want to read two input lines, we suggest to use the
Each output line must contain exactly 7 cells. We have to construct lines until all the days are printed. If the month does not start with Monday, then the first few cells must be skipped.
One possible solution is available in: main.c.
Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|