home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / learn / else.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-07  |  293 b   |  17 lines

  1. /* ELSE.C: Demonstrate else clause. */
  2.  
  3. #include <stdio.h>
  4. #include <conio.h>
  5. #define  B_KEY  'b'
  6.  
  7. main()
  8. {
  9.    char ch;
  10.    printf( "Press the b key to hear a bell.\n" );
  11.    ch = getch();
  12.    if( ch == B_KEY )
  13.       printf( "Beep!\a\n" );
  14.    else
  15.       printf( "Bye bye.\n" );
  16. }
  17.