integer values A to Z [upper case]

Bjarne Stroustrup “Programming Principles and Practice Using C++”
Chapter 4 Try This page 113
Using std_lib_facilities.h by Bjarne Stroustrup.

[code language=”cpp”]
// Philipp Siedler
// Bjarne Stroustrup’s PP
// Chapter 4 Try This page 113

#include "std_lib_facilities.h"

int main()
{
for (char character = ‘A’; character != ‘Z’ + 1; character++)
{
int integer = character;
cout << character << ‘\t’ << integer << ‘\n’;
}
keep_window_open();
}
[/code]

Output:
A       65
B       66
C       67
D       68
E       69
F       70
G       71
H       72
I       73
J       74
K       75
L       76
M       77
N       78
O       79
P       80
Q       81
R       82
S       83
T       84
U       85
V       86
W       87
X       88
Y       89
Z       90
Please enter a character to exit

Leave a Reply