#include #include #pragma hdrstop using namespace std; char gameMenu( char ); //--------------------------------------------------------------------------- #pragma argsused int main(int argc, char* argv[]) { char choice; int b = 1; int r = 4; int g = 2; while ( choice != 27 ) { gameMenu ( choice ); switch ( choice ) { case ' ': cout << "\a"; break; case 'b': case 'B': textbackground ( b ); clrscr(); break; case 'r': case 'R': textbackground ( r ); clrscr(); break; case 'g': case 'G': textbackground ( g ); clrscr(); break; } } return 0; } //--------------------------------------------------------------------------- // // // // //--------------------------------------------------------------------------- char gameMenu( char choice ) { cout << "Press the Esc key to exit" << endl << "The space bar to make a beep" << endl << "B to make the screen Blue" << endl << "R to make the screen red" << endl << "G ro make the screen green" << endl << endl << ":"; choice = getch(); clrscr(); return choice; } //---------------------------------------------------------------------------