// Ch. 13 Demo Program #7
// Mr. Minich
// Purpose - this client program uses just about every member and free function of
//				the apstring class

#include <iostream>
#include "H:\C++\ClassFiles\apstring.h"
using namespace std;

void displayString(apstring);

int main()
{
        apstring word;
		apstring anotherWord("Mackey");
		char oldfashioned[20] = "Wyomissing";

		word = "cyberterrorism";

		cout << "The length of word is " << word.length() << endl;
		cout << "The letter r's first occurrence is in position " << word.find('r') + 1 << endl;
		cout << word.find("bert") << endl;
		cout << word.substr(5,6) << endl;
// oldfashioned = word.c_str();		// illegal since = not work with char arrays

		strcpy(oldfashioned, word.c_str());
		cout << oldfashioned << endl;
		word += "philipp";
		cout << word << endl;
		word += 'A';
		cout << word << endl;
		cout << word[2] << endl;
		displayString(anotherWord);
		cout << word << endl;
		getline(cin, anotherWord);
		cout << anotherWord << endl;
		word = "B";
		anotherWord = "A";

		if (word > anotherWord)
		{
			cout << "word is alphabetically greater than anotherWord" << endl;
		}

		cout << word + anotherWord << endl;
		cout << 'A' + word << endl;
		cout << word + 'A' << endl;
		cout << word + oldfashioned << endl;
       return 0;

}// end of main

void displayString(apstring incomingString)
{
	cout << incomingString << endl;
}// end of displayString