-------------------------------------------------- In C++ The program must be ca
ID: 3755993 • Letter: #
Question
--------------------------------------------------
In C++
The program must be called "validator" and take 2 command line parameters a state machine filename, then a filename of inputs to validate. For example: validator myStateMachine.txt mylnputs.txt State Machine: The state machine will come from a text file in the following space delimited format: umber For example: 0 A1 0 a 1 1 B 2 1 b 2 2 C 999 There are three terminal situations: 999 success- when this state is reached, print "Success" and end. failure (no transitions match) print "Failure at position found character_." failure (input string ends early) - print "Input string ended before success transition." Note - each state can have ANY NUMBER (1 or more) of transitions to other states. The transitions do not have to happen in any specific order (for example-state 1 could transition forwards to state 4 and state 5 could transition backward to state 2). States will be sorted in the text file (0,1,2,3,4, etc.). Input File: The inputs to validate is some number (1 or more) of lines of text. Example: abcExplanation / Answer
#include #include using namespace std; int main() { int a; couta; while(1) { if(cin.fail()) { cin.clear(); cin.ignore(numeric_limits::max(),’ ’); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.