English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

write a c++ program that would print a calendar. input month number from 1 to 12 only, number of the days in a month and the first day of the month from 1 to 7.
sample output
screen 1
input month number: 12
enter year: 2005
first day of the month: 4

2nd screen
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

(the 2nd screen should look like a CALENDAR but due to typing error th number are not align into the month)

2007-10-04 04:06:42 · 2 answers · asked by dexie 1 in Science & Mathematics Mathematics

2 answers

Make a 5 x 7 array to hold the dates,

a[0][0] would correspond to the first possible sunday
Then based on the starting day have it put one in that spot, so if the first day of the month i.e.

a[startdate][0] would put a number in there
then write a loop to fill the remaining days up to the max day

then a loop to print the results to the screen

2007-10-04 04:12:06 · answer #1 · answered by Mαtt 6 · 0 0

I could write this for you. In fact, I was helping another programming student with this exact problem and wrote it for myself to make sure I was giving the proper help. But you can't learn programming this way. You have to write the program yourself. If I send you my code, then you will get a good score on this assignment, but when it comes exam time you are going to fail miserably. Your instructor will put 2 and 2 together and quite possibly fail you for the entire class for not doing your own work

If you want help, email me at dogsafire@yahoo.com. I will help, but I will NOT do your work for you. That would not be helping.

By the way, the main issue in this program is keeping track of what day to start each month on.

2007-10-04 04:14:13 · answer #2 · answered by dogsafire 7 · 0 0

fedest.com, questions and answers