#include <iostream> #include <algorithm> #include <string> #define DEBUG if(true) using namespace std; string dictionary[110]; int dicPos = 0; string scrambledWord; string sentinel = "XXXXXX"; string currentWord; bool invalidWord; void process() { do { cin >> dictionary[dicPos]; dicPos++; } while (dictionary[dicPos-1] != sentinel); DEBUG cout << "Dictionary Read-In Complete.\n"; sort(dictionary, dictionary + dicPos); while (cin >> scrambledWord && scrambledWord != sentinel) { sort(scrambledWord.begin(), scrambledWord.end()); invalidWord = true; for(int i=0; i < dicPos; i++) { currentWord = dictionary[i]; sort(currentWord.begin(), currentWord.end()); if(scrambledWord == currentWord) { cout << dictionary[i] << "\n"; invalidWord = false; } } if (invalidWord) { cout << "NOT A VALID WORD" << "\n******\n"; } } } int main() { process(); return 0; }The statements and opinions included in these pages are those of only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014