Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Input year, then print calendar

Tags:

c

I am stuck on the following problem from my C programming class:

Write a program that prompts the user to input a year, and then outputs the calendar(for the entire year).

I have no idea how to approach this problem. I can usually start my homework problems (this is an optional challenge problem), but I am really lost. We've worked through chapters 1-10 of Deitel & Deitel (loops, arrays, pointers, I/O, etc), but I don't know how to approach this at all. Any hints or suggestions would be appreciated.

like image 859
alexis Avatar asked Jan 12 '10 02:01

alexis


2 Answers

It might help you to understand the mathematics of the calendar. If the fabulous book Calendrical Calculations is not in your university library, they may be able to get you a reprint of the article by the same authors in Software—Practice & Experience. And ask your prof to request the book for the library.

like image 142
Norman Ramsey Avatar answered Sep 22 '22 14:09

Norman Ramsey


In general, when you have a big problem like this one, you want to break it down into little problems that are easier to solve.

Here's one possible little problem to start with: if you know how many days there are in a month, and what weekday the first of the month falls on, could you output a calendar for that month?

like image 26
Pillsy Avatar answered Sep 25 '22 14:09

Pillsy