So I this Ceaser cihper code that I wrote, but I would like it to only encrypt every fifth letter. So if I write, aaaaaaaaaaaaa it would become nnnnnaaaaannn.
if((i % 5) == 0) // This means every 5th index (5, 10, 15, ...)
So if I write, aaaaaaaaaaaaa it would become nnnnnaaaaannn.
This is not ever 5th.
To achieve this you need to (integer) length /= 5. Use 2 nested loops. In the inner loop write 5 characters either encrypted or not depending on a bool variable e.g. is_encrypted. For the alternation you can use bool is_encrypted = !is_encrypted before the inner loop (initialize it properly before the outer loop of course).