In Review 169
44: {
CH 05 45: cont = display_instructions();
46:
CH 04 47: if ( cont == YES )
48: {
CH 05 49: get_data();
CH 05 50: display_report();
51: }
CH 04 52: else
CH 07 53: printf( “\nProgram Aborted by User!\n\n”);
54:
55: return 0;
56: }
CH 02 57: /*-----------------------------------------------------------*
58: * Function: display_instructions() *
59: * Purpose: This function displays information on how to *
60: * use this program and asks the user to enter 0 *
61: * to quit, or 1 to continue. *
62: * Returns: NO - if user enters 0 *
63: * YES - if user enters any number other than 0 *
64: *-----------------------------------------------------------*/
CH 05 65: int display_instructions( void )
66: {
CH 07 67: printf(“\n\n”);
68: printf(“\nThis program enables you to enter up to 99 people\’s “);
69: printf(“\nincomes and birthdays. It then prints the incomes by”);
70: printf(“\nmonth along with the overall income and overall average.”);
71: printf(“\n”);
72:
CH 05 73: cont = continue_function();
CH 05 74: return( cont );
75: }
CH 02 76: /*-------------------------------------------------------------*
77: * Function: get_data() *
78: * Purpose: This function gets the data from the user. It *
79: * continues to get data until either 100 people are *
80: * entered, or until the user enters 0 for the month.*
81: * Returns: nothing *
82: * Notes: This allows 0/0/0 to be entered for birthdays in *
83: * case the user is unsure. It also allows for 31 *
84: * days in each month. *
85: *-------------------------------------------------------------*/
86:
CH 05 87: void get_data(void)
88: {
CH 06 89: for ( cont = YES, ctr = 0; ctr < MAX && cont == YES; ctr++ )
90: {
CH 07 91: printf(“\nEnter information for Person %d.”, ctr+1 );
92: printf(“\n\tEnter Birthday:”);
93:
LISTINGR1.1 continued
12 448201x-W1R 8/13/02 11:15 AM Page 169