home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tybc4 / if3.cpp < prev    next >
C/C++ Source or Header  |  1993-03-19  |  477b  |  20 lines

  1. // Program demonstrates the multiple-alternative if statement
  2.  
  3. #include <iostream.h>
  4.  
  5. main()
  6. {
  7.   char c;
  8.   cout << "Enter a character : ";
  9.   cin >> c;
  10.   if (c >= 'A' && c <= 'Z')
  11.     cout << "You entered an uppercase letter\n";
  12.   else if (c >= 'a' && c <= 'z')
  13.     cout << "You entered a lowercase letter\n";
  14.   else if (c >= '0' && c <= '9')
  15.     cout << "You entered a digit\n";
  16.   else
  17.     cout << "You entered a non-alphanumeric character\n";
  18.   return 0;
  19. }
  20.