characterIO

characterIO - Programming Character I/O 2 Prog....

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Programming Character I/O
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
02 Prog. Fundamentals I: Character I/O/ Slide 2 More on char Type Constant Declaration: const char star = '*'; Variable Declaration: char letter; Variable Assignment : letter = 'A'; Input/Output: char t, x, y, z; cin >> t >> x >> y >> z; INPUT: 1X3Y t = '1'; x = 'X'; y = '3'; z = 'Y'; cout << t << x << y << z << endl; OUTPUT: 1X3Y
Background image of page 2
02 Prog. Fundamentals I: Character I/O/ Slide 3 Example 1 #include <iostream.h> int main() { char character; cout << "Please enter a character!\n"; cin >> character; cout << "As int " << ( int )(character) << endl ; cout << "As char " << ( char )(character) << endl; cout << "As bool "; if (( bool )(character)) cout << "true\n"; else cout << "false\n"; return 0; }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
02 Prog. Fundamentals I: Character I/O/ Slide 4 Classifications of the character type characters control printable space graphical alphanumeric punctuation alphabetic digit upper lower
Background image of page 4
02 Prog. Fundamentals I: Character I/O/ Slide 5 Some Functions on char from ctype.h Classifying Functions : isupper(c)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

characterIO - Programming Character I/O 2 Prog....

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online