// Ch. 13 Demo Program #4
// Mr. Minich
// purpose - to illustrate an apstring class accessor method that returns
//              an encrypted version of an apstring by changing each character 
// to the next character in the ASCII table.

#include <iostream.h>
#include "apstring.h" // modified to include the encrypt member function int main() { apstring stringToEncrypt("alpha"); // user input that will be encrypted cout << "Enter a string to encrypt: "; cin >> stringToEncrypt; cout << "The encrypted version of the string is " << stringToEncrypt.encrypt() << endl;
cout << "The original string, " << stringToEncrypt << ", has not been modified./n"
return 0; }// end of main

THIS IS THE ADDITIONAL ACCESSOR METHOD THAT IS ADDED TO THE APSTRING CLASS IMPLEMENTATION
(APSTRING.CPP FILE)

const apstring & apstring::encrypt()
// postcondition: the apstring object is not modified in any way
{
	for (int i = 0; i < myLength; i++)  // myLength is private data
 	{
		cout << myCstring[i] + 1;   // myCstring is private data
    }

}// end of encrypt

THIS IS THE ADDITIONAL ACCESSOR MEMBER FUNCTION PROTOTYPE THAT IS ADDED TO THE
APSTRING CLASS DEFINITION (APSTRING.H HEADER FILE)

void encrypt( );      // displays an encrypted string