Assume the language ? = {Ascii symbols including digits). Construct a DFA which
ID: 3564975 • Letter: A
Question
Assume the language ? = {Ascii symbols including digits). Construct a DFA which will accept the string 011 ( a representation for the number 3), and reject 101 ( a representation for number 5) and also reject strings 01i and fred. (Let us call it Mod3 DFA).
Write a code in a high-level language (C++) for this DFA. Create an input file containing the numbers zero through ten in binary and adam, mary, cindy, 01i , and fred Show the output.
Explanation / Answer
#include #include #include #include using namespace std; int main() { string *states, *final, *trap, **transition,input, tmp; char *alf, temp; int nos, nots, nofs, noa, i, j, current, flag; cout > nots; cout > noa; states = new string[nos]; final = new string[nofs]; trap = new string[nots]; alf = new char[noa+1]; cout states[i]; cout final[i]; cout trap[i]; cout alf[i]; //allocating space for the transition table transition = new string *[nos]; for (i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.