[cs13001] Lab13_vectvectors
Mikhail Nesterenko
mikhail at cs.kent.edu
Tue Apr 22 20:59:33 EDT 2014
> However, my question pertains to the switch i need to build to convert the
> char of "shot fired" to an int.
> this is what I coded:
>
> /*switch (shot){
> case 'a': column = 0; break;
> case 'b': column = 1; break;
> case 'c': column = 2; break;
....
> case 'y': column = 25; break;
> case 'z': column = 26; break;
> };*/
suppose the letter of the shot is stored in a character variable SHOT. Then,
to place the star in SHOT's column, you need to print
SHOT-'a' spaces, and then print a '*'
Thanks,
--
Mikhail
More information about the cs13001
mailing list