Understanding how to use arrays

Im working on an assignment where Im reading arrays of data where sets of 3 characters will be translated to one. I essentially need to check a triplet of characters like CAU and in a new array write H. Im not sure how to read down three characters.

example would be: GCUCAUAUU needs to be read as: GCU CAU AUU which translates to: AHI

The original thought that I had would be a forrest of if/else statements to check each character in the array and if the next character matched one in the pattern continue onto the next... But i feel like there must be an easier way.
I also considered the idea of if there was a way to use several for loops with

 
for ( int i = 0; i < length; i+=3 )

and use [i], [i+1], [i+2], to walk 3 at a time, and then use a switch statement to change the triplets to a single character... but I have no idea how to write this to make it work...

Some guidance would be nice
If the data source is of type std::string then you may find some interesting methods on Cplusplus.com "Reference". F.e. substr(pos, length) -> string

Using a loop is not the worst idea :-) Give us a more complete example please.
Topic archived. No new replies allowed.