home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap05 / ifelse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-05  |  508 b   |  22 lines

  1. /* ifelse.c -- IF with ELSE */
  2.  
  3. char ch;
  4. int num;
  5. main()
  6. {
  7.     printf("Are you a new user? y/n? ");
  8.     if (ch = getche() == 'y')
  9.         {
  10.         /* executed if IF is true */
  11.         printf("\n\nYou must register to use this\n");
  12.         printf("bulletin board. Please read\n");
  13.         printf("Bulletin #1 first. Thank You.\n");
  14.         }
  15.     else
  16.         /* executed if IF is false */
  17.         {
  18.         printf("\n\nEnter your secret number: ");
  19.         scanf("d", &num);
  20.         }
  21. }
  22.