/*

Copyright: 2000, All rights reserved.
Program: STL Strings 2 
Version: 1.0
Created/Revised: 
File: stlstrings2.cpp
Programmer: C. S. Tritt, Ph.D.
Course: CS-150
Assignment: STL Strings Example
Compiler: Microsoft Visual C++ 6.0
Target: Win32

Description:

  This program demonstrates the use of C++ STL strings.
  The problem solved involves asking the user
  for a size code (L+, L, M, S and S-) and displying the
  corresponding text (Extra large, Large, Medium, Small
  and Extra small, respectively.

  This program compares multiple characters.

  This program uses a somewhat odd approach for demonstration
  purposes. It does not do complete error checking.

Revisions:

  There have been no major revisions of this program.

Constants and Variables:

  See code for constant and variable descriptions.

*/

// Included files.

#include <iostream>
#include <string>

// Macros for ANSI C++ logical operations in MSVC++ 6.0.

#define and &&
#define or ||
#define not !

using namespace std;

int main()
{

	// Define constants.

   const string XLARGE = "L+";
   const string LARGE = "L";
   const string MEDIUM = "M";
   const string SMALL = "S";
   const string XSMALL = "S-";

   // Get input.

   cout << "Please enter a size code: ";
   string scode;
   cin >> scode;

   // Process input.

   cout << "Size: ";
   if (scode.length() > 2)
   {
      cout << "Invalid code: too many letters\n";
      return 1;
   }
   else
   {
      if (scode == XLARGE) cout << "Extra large";
      else if (scode == LARGE) cout << "Large";
      else if (scode == MEDIUM) cout << "Medium";
      else if (scode == SMALL) cout << "Small";
      else if (scode == XSMALL) cout << "Extra small";
      else
      {
         cout << "Invalid code.\n";
         return 2;
      }
   }
   cout << '\n';

   
   // Everything worked.

	return 0;
}