168 Week 1
LISTINGR1.1 week1.c. Week 1’s review listing
CH 02 1: /* Program Name: week1.c */
2: /* Purpose: Program to enter the ages and incomes of up */
3: /* to 100 people. The program prints a report */
4: /* based on the numbers entered. */
5: /*-----------------------------------------------------------*/
6: /*--------------------*/
7: /* included files */
8: /*--------------------*/
CH 02 9: #include <stdio.h>
10:
CH 02 11: /*--------------------*/
12: /* defined constants */
13: /*--------------------*/
14:
CH 03 15: #define MAX 100
16: #define YES 1
17: #define NO 0
18:
CH 02 19: /*--------------------*/
20: /* variables */
21: /*--------------------*/
22:
CH 03 23: long income[MAX]; /* to hold incomes */
24: int month[MAX], day[MAX], year[MAX]; /* to hold birthdays */
25: int x, y, ctr; /* For counters */
26: int cont; /* For program control */
27: long month_total, grand_total; /* For totals */
28:
CH 02 29: /*--------------------*/
30: /* function prototypes*/
31: /*--------------------*/
32:
CH 05 33: int main(void);
34: int display_instructions(void);
35: void get_data(void);
36: void display_report(void);
37: int continue_function(void);
38:
39: /*--------------------*/
40: /* start of program */
41: /*--------------------*/
42:
CH 02 43: int main(void)
The numbers in the left margin indicate the day that covers the concept pre-
sented on that line. If you are confused by a particular line, refer to that day
for more information.
Note
12 448201x-W1R 8/13/02 11:15 AM Page 168