I am trying to make a state machine on Borland C++ Builder 6. There are 5 states (1,2,3,4,5). I want the states in ascending order so for example if the user is in state1 and tries to go to state3 the program will print "wrong key, try again". Once the users presses the right key it should go on to the next state. The problem is the last funtion finishup it's not working properly. I want the user to only have the opinion of pressing 'Q' or 'q' to quit the program while in the final state(state 5). The program should then conduct one more print out and quit. The finishup function is suppose to:
1. Read the response and see if it is equal to 'Q' or 'q'
2. If the response is equal to one of the two characters the program will print "This has been a successful state machine test." and quit.
3. If it is not equal to one of the two characters the program will print "wrong key, try again"
The if statement for an incorrect key press is working properly, but the if statement for a correct key press isn't. The if statement for the correct key press keeps printing out its sentence and the sentence for an incorrect key press and also the program won't quit.
The first bit of code is the program file and the code about 10-11 lines below that is the header file. Please somebody help me out; I'm at a lost. I don't what the problem is.
1. Read the response and see if it is equal to 'Q' or 'q'
2. If the response is equal to one of the two characters the program will print "This has been a successful state machine test." and quit.
3. If it is not equal to one of the two characters the program will print "wrong key, try again"
The if statement for an incorrect key press is working properly, but the if statement for a correct key press isn't. The if statement for the correct key press keeps printing out its sentence and the sentence for an incorrect key press and also the program won't quit.
The first bit of code is the program file and the code about 10-11 lines below that is the header file. Please somebody help me out; I'm at a lost. I don't what the problem is.