topical media & game development
basic-program-code-03-Ex3-11.c
? /
basic-program-code-03-Ex3-11.c
// Ex3_11.cpp
// Display ASCII codes for alphabetic characters
include <iostream>
include <iomanip>
using std::cout;
using std::endl;
using std::hex;
using std::dec;
using std::setw;
int main()
{
for(char capital = 'A', small = 'a'; capital <= 'Z'; capital++, small++)
cout << endl
<< "\t" << capital // Output capital as a character
<< hex << setw(10) << static_cast<int>(capital) // and as hexadecimal
<< dec << setw(10) << static_cast<int>(capital) // and as decimal
<< " " << small // Output small as a character
<< hex << setw(10) << static_cast<int>(small) // and as hexadecimal
<< dec << setw(10) << static_cast<int>(small); // and as decimal
cout << endl;
return 0;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.