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

  1. // Program demonstrates the dual-alternative if statement
  2.  
  3. #include <iostream.h>            
  4. #include <ctype.h>
  5.  
  6. main()
  7. {
  8.   char c;
  9.   cout << "Enter a letter : ";
  10.   cin >> c;      
  11.   // convert to uppercase         
  12.   c = toupper(c);
  13.   if (c >= 'A' && c <= 'Z')
  14.     cout << "You entered a letter\n";
  15.   else
  16.     cout << "Your input was not a letter\n";
  17.   return 0;
  18. }
  19.