/*---------------------------------------------------------- Elizabeth Sklar MC140.0X 22 September 2000 This program prints out graphical objects (using ASCII graphics), based on input from the user. The user selects objects to print from a menu. This code is contains stubs for some routines, which should be completed for assignment #2!!! ----------------------------------------------------------*/ #include /*--------------------------------------------------------*/ /* get_option */ /* */ /* This function prints the menu and gets the user's */ /* choice of what to do. */ /* */ /*--------------------------------------------------------*/ char get_option( ) { char tmp[2]; printf( "R (draw rectangle)\n" ); printf( "S (draw square)\n" ); printf( "Q (quit)\n" ); printf( "enter option: " ); scanf( "%s",tmp ); return( tmp[0] ); } /* end of get_option() */ /*--------------------------------------------------------*/ /* draw_rectangle */ /* */ /* This function draws a rectangle. */ /* */ /*--------------------------------------------------------*/ void draw_rectangle( ) { int i; // loop counters // this draws the rectangle for ( i=0; i<5; i++ ) { printf( "*******\n" ); } } /* end of draw_rectangle() */ /*--------------------------------------------------------*/ /* draw_square */ /* */ /*--------------------------------------------------------*/ void draw_square( ) { } /* end of draw_square() */ /*--------------------------------------------------------*/ /* quit */ /* */ /*--------------------------------------------------------*/ void quit( ) { } /* end of quit() */ /*--------------------------------------------------------*/ /* main program */ /* */ /*--------------------------------------------------------*/ void main( ) { char option = ' '; while ( option != 'Q' ) { option = get_option(); if ( option == 'R' ) { draw_rectangle(); } else if ( option == 'S' ) { draw_square(); } } /* end of while */ quit(); } /* end of main() */