/* ------------------------------------------------------------------------------ // Figure 5.5 Calling void:void functions. // Demonstrate the definition and use of various void:void functions. // ------------------------------------------------------------------------------ */ /* Include header files for tools and several standard libraries. ------------ */ #include "tools.h" /* These are the prototype declarations for the user-defined functions. ------ */ void instructions( void ) ; void beep( void ); void main( void ) { int n_pass; /* Number of passengers in car. */ banner(); /* Display output headings. */ instructions(); /* Display instructions for the user. */ scanf( "%i", &n_pass ); if (n_pass > 5) { beep(); /* Error message for n>5 */ } else { printf( " OK! \n" ); /* Success message for good entry */ } bye(); } /* ----------------------------------------------------------------------- */ void instructions( void ) /* function definition */ { printf( " This is a legal-passenger-load tester for 6-seat sedans.\n" " Please input the number of passengers you will transport: " ); } /* ----------------------------------------------------------------------- */ void beep( void ) /* function definition */ { printf( " Bad data! \n\a\a\a\a\n" ); /* error message and beeps */ }