SOURCE FILE: simEg.cpp



/* Solution to a Similar (but different) Problem */

/* This program is greatly simplified to allow 
   quicker presentation in class.   */

#include <iostream>
using namespace std ;

int main (void)
{
   /*
      if the character is a lower-case letter and not a vowel.

      b c d f g h j
      k l m n p q r
      s t v w x y z

    then output 1, 2, or 3, depending which row the letter is in.

    otherwise
       if it's a lower-case vowel, say so
       if it's an upper-case letter, say so
       if it's a digit, say so
       if it's some other bad input, say so
   */

   char theChar ;
   
   cout << "\nThis is where the directions go.\n\n" ;

   cout << "Please enter a character: " ;
   cin >> theChar ;

   if ( ('a' <= theChar) && (theChar <= 'z') && (theChar != 'a') && 
        (theChar != 'e') && (theChar != 'i') && (theChar != 'o') && 
        (theChar != 'u')  )
   {
          if  ( ('b' <= theChar) && (theChar <= 'j') )
              cout << endl << theChar << " ===> 1\n\n"  ;
     else if  ( ('k' <= theChar) && (theChar <= 'r') ) 
              cout << endl << theChar << " ===> 2\n\n"  ;
     else     cout << endl << theChar << " ===> 3\n\n"  ;
   }
   else
   {
          if  ( (theChar == 'a') || (theChar == 'e') || (theChar == 'i') || 
                (theChar == 'o') || (theChar == 'u')  )
              cout << endl << theChar << " is a lower case vowel\n\n" ;
     else if  (  ('A' <= theChar) && (theChar <= 'Z') ) 
              cout << endl << theChar << " is an upper-case letter\n\n" ;
     else if  (  ('0' <= theChar) && (theChar <= '9') ) 
              cout << endl << theChar << " is a digit\n\n" ;
     else     cout << endl << theChar 
                   << " is some bad input not a digit or letter\n\n" ;
   }

   return 0;
}