// Mr. Minich
// CMPSC 101
// Ch. 3 Demo Program #4
// January 30, 2000 
// Purpose - to illustrate the relationship between char and int datatypes as well as typecasting

#include <iostream>
using namespace std;

int main()
{
	char start = 65;     // initialized to the letter 'A' (see the ASCII Table)
// since start is the char datatype
char letterM = 77; // initialized to the letter 'M' char mystery; // used to produce an interesting effect later in the program int gap = 32; // the numerical difference between upper & lowercase alphabets // in the ASCII Table cout << "The first letter is " << start << endl; cout << "The first lowercase letter is " << start + gap << endl;
// this line prints an integer since C++ uses promotes the // sum of an int and a char to an int cout << "The first lowercase letter is really " << char (start + gap) << endl;
// the programmer uses typecasting to force compiler to // printout the actual letter that is desired
mystery = letterM + 257; cout << "The letter of M is " << mystery << endl; cout << "The ASCII value of mystery is " << int (mystery) << endl;
// example of typecasting to force a char to be treated as an int
return 0; }// end of main