Characters
- Any single character:
char letter;
- Assignment:
letter = 'X';
cin >> letter;
- Internal representation: ASCII table.
- Conversion between int and char:
int('A') = 65
char(65) = 'A'
- How would you convert from character '2' to the integer 2?
- Escape sequences: \ causes the next character to be read literally.
cout << "I said "no" and left" //error!
cout << "I said \"no\" and left" //fine
The same:
cout << "Hello" << endl;
cout << "Hello\n";
\n: newline
\t: tab
\a: bell