i want to find the alphabet charachter that is 7 charachters before mine ,so i wrote this function to do so and it works fine :
char find7_before(char letter){
switch (letter){
case 'g':
return 'z';
break;
case 'f':
return 'y';
break;
case 'e':
return 'x';
break;
case 'd':
return 'w';
break;
case 'c':
return 'v';
break;
case 'b':
return 'u';
break;
case 'a':
return 't';
break;
default:
return (char)(((int)letter) - 7);
}
}
but i think i can do it in a smarter way without all of these cases but i just can't figure it out ! (i figured how to find 7 letters after in a cyclic way ) any help or an idea or a hint ? thank you :)