Quote Originally Posted by jackson6612 View Post
Why do I have to enclose A, Z, 0, and 9 within single quotes? Otherwise my code didn't work.
Good question. The reason is that when you want the actual character, J, for example, the compiler needs to know that you mean J the character and not J the variable. E.g.:

Code:
int main()
{
    int J = 3;
    cout << J << endl; // outputs 3
    cout << 'J' << endl; // outputs J
    return 0;
}
Of course it's conceivable you could make a language in which if there was no variable J available then
Code:
cout << J << endl;
would output J the character instead. However, this makes code difficult to read because someone reading it who hasn't seen the whole program will probably expect J stores some value that is being printed. For this reason, in C++ and other languages, you need to put quotes around the letter whenever you mean the letter itself and not a variable.