//Stephen Bassoli #include #include #include #include "FAmanip.h" extern char alphabet[10]; int main() { int states, alpha, from, to; char via; char useless[2]; cout << "How many states will there be? "; cin >> states; cout << "How big will the alphabet be without (E)psilon? "; cin >> alpha; FAmanip FA(states,alpha); cout << "Begin entering connections in the format: from via to\n"; cout << "For example 1 E 2 says state 1 goes to state 2 on epsilon\n"; cout << "The states start at 0 and ascend, the alphabet begins at 'a' and ascends\n"; cout << "Enter connections now (end by typing '-1'):\n\n"; while (true) { cin >> from; if (from == -1) { cin.ignore(255,'\n'); break; } cin >> via >> to; FA.setConnection(from,to,via); } cout << "What states will be final states? End with -1\n"; while (true) { cin >> from; if (from == -1) { cin.ignore(255,'\n'); break; } FA.setEndState(from); } cout << "Press enter to convert into an NFA\n"; cin.getline(useless,2,'\n'); FA.CONVERTtoNFA(); FA.printFA(); cout << "Press enter to convert into a DFA\n"; cin.getline(useless,2,'\n'); FA.CONVERTtoDFA(); FA.printFA(); cout << "Press enter to quit\n"; cin.getline(useless,2,'\n'); return 0; }