home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc / qc25 / else1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-15  |  340 b   |  19 lines

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