It looks like your
are not doing what you expect. For instance:
// This code will *always* execute
You ought to be using the double equals
== to compare a value, and a single
= to assign a value.
(Edit after additional code change)
Inside the for-loop, you are trying to use
cin to read in a single character.
However, since the
z is an integer,
cin is looking for a valid integer,
which does not happen to include 'A' or 'B',
Perhaps you should try using a