I'd like to know more about the concept of State Machines, and have seen code that has STATE in the body of the C++ code, but it is not in the Main. Can someone give me a beginners overview of how this functionality works? What has to be declared in that portion of the code?
All computers and computer programs are state machines.
In C and C++ (and all other computer languages) an object (integer, string, etc) stores state -- meaning that it remembers the way a thing is -- while the code represents the transitions if (x == 12) ... else ....
So long as an object exists (its lifetime) it represents part of the program's state.