Hello,
I have to do simple program which will be work like Deterministic Finite-state Automaton. DFS will be accept some language describe by regular expression (e.g. (a + b)*). Program will read word from text file and analyse it. If word is acceptable program will give info to user.
I don't know how to start. Thnx for any help.

P.S. Sorry for my poor english :icon_cheesygrin:

Your first step should be to determine what possible states you can have.

What is your initial state?

Then define each state along the path. From the current state, what happens if good input is encountered; what state will it move to? Do the same for if bad input is encountered. You can do this all in plain english or psuedo code). Draw a map of the machine if you need to to help keep everything straight.

Once you have the states and how they interact based on input, describe them with code using if/else or case structures and maybe variables to keep track of the current state.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.