Rather than using the array syntax that doesnt work in C++, use a switch state which is also much easier to read.