/*

Copyright: 2000, All rights reserved.
Program: C Strings 
Version: 1.1
Created/Revised: 
File: cstrings.cpp
Programmer: C. S. Tritt, Ph.D.
Course: CS-150
Assignment: C Strings Example
Compiler: Microsoft Visual C++ 6.0
Target: Win32

Description:

  This program demonstrates the use of C strings in
  C++. 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 version also recognizes
  lower case letters.

  This program uses a somewhat odd approach for demonstration
  purposes. It does not do error checking and it is possible
  to overflow the input string with improper input.

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 <cstring>

// Macros for ANSI C++ logical operations in MSVC++ 6.0.

#define and &&
#define or ||
#define not !

using namespace std;

int main()
{

	// Define constants.

   const char LARGE[] = "Ll"; // Change to Gg for European use.
   const char MEDIUM[] = "Mm";
   const char SMALL[] = "Ss"; // Change to Pp for European use.
   const char PLUS[] = "+";
   const char MINUS[] = "-";

   // Get input.

   cout << "Please enter a size code: ";
   char scode[3];
   cin >> scode; // Dangerous if more than 2 characters are entered.

   // Process input.

   cout << "Size: ";
   if (scode[1] == PLUS[0])
      cout << "Extra large\n";
   else if (scode[1] == MINUS[0])
      cout << "Extra small\n";
   else if (scode[0] == LARGE[0] or scode[0] == LARGE[1])
      cout << "Large";
   else if (scode[0] == MEDIUM[0] or scode[0] == MEDIUM[1])
      cout << "Medium";
   else if (scode[0] == SMALL[0] or scode[0] == SMALL[1])
      cout << "Small";
   else
   {
      cout << "Invalid\n";
      return 1;
   }

   cout << '\n';

   
   // Everything worked.

	return 0;
}