home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / lsdoor09.zip / EXAMPLE2.CPP < prev    next >
Text File  |  1996-05-15  |  723b  |  34 lines

  1. // Example2.Cpp - Asking a Y/N Question safely...
  2.  
  3. #define MainModule
  4. #include "LsDoor.H"
  5.  
  6. char *errorModule( void ){ return "Example II"; }  // Identify ourself...
  7.  
  8. char c;
  9.  
  10. void main( void )
  11. {
  12.   if( !DoorInit( doorsysDISABLE ) ) exit(1);      // Get things started...
  13.   display("\n@WS@wtar @WW@wings @WG@wame" );
  14.   while( online )
  15.   {
  16.     display("\nDo you wish to play?  (Y/N)  ");
  17.     c = toupper( s_in() );
  18.     if( c == 'Y' || c == '\r' )
  19.     {
  20.       display("\nGame over."); exit(0);
  21.     }
  22.     if( c == 'N' )
  23.     {
  24.       display("\nReturning to the 20th century."); break;
  25.     }
  26.   }
  27.   exit(0);                                        // Always use exit()
  28. }
  29.  
  30. // End of Example2.Cpp
  31.  
  32.  
  33.  
  34.