// Mr. Minich
// Computer Science Using C++
// Ch. 9 Demo Program #7 // July 21, 2000 // Purpose - to illustrate passing a char argument to a function that // returns a char
#include <iostream.h> char encrypt(char x); // changes a character int main() { char userLetter = 'a'; // character to be changed as entered by user cout << "Enter a letter to be encrypted: "; cin >> userLetter; cout << "The value of your letter is " << encrypt(userLetter) << endl; return 0; } // end of main char encrypt(char letterInputted) { // accepts a character as an input // returns a character after it has been changed char temp; // local temporary variable temp = ++letterInputted;
// incrementing operator works here to change letter to nextletter in alphabet

// note that the 2 statements above could be consolidated to // return ++letterInputted;
return temp; } // end of encrypt