[cs13001] Lab13_vectvectors

Mikhail Nesterenko mikhail at cs.kent.edu
Tue Apr 22 19:50:22 EDT 2014


> I was starting to build my switch for the vector part of the lab and I was
> curious if character addition was possible in declaring the cases?
> 
> for example:
> for(i=0;i<oceanwidth; ++i..)
>  case'a': column =0;
> case 'a+i': column= column + i;
> 
> This would avoid typing a switch with up to 26 possible outputs and
> condense my code.

Or better yet:

 for(char i='a'; i < oceanWidth; ++i)
     // print out character stored in variable "i"


Thanks,
--
Mikhail


More information about the cs13001 mailing list