What to submit: source code running on UNIX, all applicable files used by your source code. No object, executable files are to be submitted. You must also submit the output files of at least three runs of your code. The files for every problem must be tar archived and then the whole homework will be tar archived with those. That will be your submission.
Problem 1 (33 points):
Write a C program to print a calendar for an entire year. The desired year is read via keyboard. You need to calculate the first day of the year as well as whether the year is leap or not. The leap year calculation is elaborated at http://www.wikihow.com/Calculate-Leap-Years . The first day calculation can be found at http://mathforum.org/library/drmath/view/55837.html .
Here is a sample output for one month:
January 2000
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
Grading:
There is no need to use arrays.
Comments 5 points
Functioning code 10 points
Well-written code 5 points
Correct calendar, ordered output 10 points
Full submission 3 points
Problem 2 (35 points):
Write an interactive C program that will simulate a game of BINGO. Print each letter-number combination as it is drawn (randomly generated). Be sure that no combination is drawn more than once. Remember that each of the letters B-I-N-G-O corresponds to a certain range of numbers, as indicated below.
B: 1-15
I: 16-30
N: 31-45
G: 46-60
O: 61-75
Each player will have a card with 5 columns, labeled B-I-N-G-O. Each column will contain 5 numbers within the range indicated above. No two players will have the same card. The first player to have one entire row of numbers drawn (either vertically, horizontally or diagonally) wins.
Implementation details: there are to be 3 players. Do not convert text to numbers or vise versa. Read each type as it is intended to be.
Grading:
There is no need to use arrays or functions.
Comments 5 points
Functioning code 10 points
Well-written code 5 points
Correct game, ordered output 12 points
Full submission 3 points
Reviews
There are no reviews yet.