I am currently taking a class in C++ which has been going very well until our current assignment. The asignment is to build a finite state machine that will take in inputs from the user see whether it is an identifier or a digit and the transistion to an approriate stage to deal with those. For example someone inputs: R2D2,Time,48,2,rate,555666. would output
and so on until it reaches the end. The program is supposed to parse each character to see what it is and from there transition to a different state. If it starts as a digit it goes from start state to digit state where it checks for more digits until it reads a comma which then says its done and it s a number so it transitions to the number state which saves it as a number and then transistions back to start. If it is a character then it goes to the build identfier state which looks for a letter or didgit to make up the name and the once again a , will terminate it and call it to the identifier state which then goes back to start. This parsing repeats until a period is found which ends the program.
A little more background information is that why are in a chapter dealing with functions so I am assuming a vast majority of this will be functions. I was informed by the professor using isalpha and isdigit will be crucial but he gave no information on there implementation and I can't find a source that explains them in a way I understand, he also said to use a case switchblock. So my idea was once I get the isalpha is digit figured out I could put those in a case switch block and when it finds if its a char or digit it goes to the approaiate state. As far as the states are concerned I was going to make each one a function and when it tansitioned just have it call the next function.
Sorry for the super long post buyt I am completly lost and can use any help anybody can offer. Thanks for taking the time to read this and any input is greatly appreciated.