mardi 25 avril 2017

Jump forward and backwards in for loop

I have some problems figuring out how to implement a for loop in C++(14). It's a normal for loop:

for (j = 65; j < 91; ++j) {
    body...
}

For the first iteration j will be 65. For the second iteration i want it to be increased by 32 (second interation j = 97). For the third it has to go back to 65 + 1 => 66. Basicly j values will be like this: 65, 97, 66, 98, 67, 99, 68, 100, 69, 101... and so on. I want the code to be minimal when talking about character used.

P.S: If it's helpful, those value are the ascii value for: A, a, B, b, C, c, D, d, F, f... TL;DR: i wanna iterate through those integers/chars in as less code as possible.

Thank you.

Aucun commentaire:

Enregistrer un commentaire