C++
This is the given code:
#include #include #include using namespace std;// The puzzle will always have exactly 20 columnsconst int numCols = 20;// Searches the entire puzzle, but may use helper functions to implement logicvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords);// Printer function that outputs a vectorvoid printVector(const vector &v);// Example of one potential helper function.// bool searchPuzzleToTheRight(const char puzzle[][numCols], const string &word,// int rowStart, int colStart)int main(){int numRows, numWords;// grab the array row dimension and amount of wordscin >> numRows >> numWords;// declare a 2D arraychar puzzle[numRows][numCols];// TODO: fill the 2D array via input// read the puzzle in from the input file using cin// create a 1D array for wodsstring wordBank[numWords];// TODO: fill the wordBank through input using cin// set up discovery vectorvector discovered;// Search for WordssearchPuzzle(puzzle, wordBank, discovered, numRows, numWords);// Sort the resultssort(discovered.begin(), discovered.end());// Print vector of discovered wordsprintVector(discovered);return 0;}// TODO: implement searchPuzzle and any helper functions you wantvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords){}// TODO: implement printVectorvoid printVector(const vector &v){}
using namespace std;
// The puzzle will always have exactly 20 columnsconst int numCols = 20;
// Searches the entire puzzle, but may use helper functions to implement logicvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords);// Printer function that outputs a vectorvoid printVector(const vector &v);// Example of one potential helper function.// bool searchPuzzleToTheRight(const char puzzle[][numCols], const string &word,// int rowStart, int colStart)int main(){int numRows, numWords;// grab the array row dimension and amount of wordscin >> numRows >> numWords;// declare a 2D arraychar puzzle[numRows][numCols];// TODO: fill the 2D array via input// read the puzzle in from the input file using cin// create a 1D array for wodsstring wordBank[numWords];// TODO: fill the wordBank through input using cin// set up discovery vectorvector discovered;// Search for WordssearchPuzzle(puzzle, wordBank, discovered, numRows, numWords);// Sort the resultssort(discovered.begin(), discovered.end());// Print vector of discovered wordsprintVector(discovered);return 0;}// TODO: implement searchPuzzle and any helper functions you wantvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords){}// TODO: implement printVectorvoid printVector(const vector &v){}
// Printer function that outputs a vectorvoid printVector(const vector &v);// Example of one potential helper function.// bool searchPuzzleToTheRight(const char puzzle[][numCols], const string &word,// int rowStart, int colStart)int main(){int numRows, numWords;// grab the array row dimension and amount of wordscin >> numRows >> numWords;// declare a 2D arraychar puzzle[numRows][numCols];// TODO: fill the 2D array via input// read the puzzle in from the input file using cin// create a 1D array for wodsstring wordBank[numWords];// TODO: fill the wordBank through input using cin// set up discovery vectorvector discovered;// Search for WordssearchPuzzle(puzzle, wordBank, discovered, numRows, numWords);// Sort the resultssort(discovered.begin(), discovered.end());// Print vector of discovered wordsprintVector(discovered);return 0;}// TODO: implement searchPuzzle and any helper functions you wantvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords){}// TODO: implement printVectorvoid printVector(const vector &v){}
int main(){int numRows, numWords;
// grab the array row dimension and amount of wordscin >> numRows >> numWords;// declare a 2D arraychar puzzle[numRows][numCols];// TODO: fill the 2D array via input// read the puzzle in from the input file using cin
// create a 1D array for wodsstring wordBank[numWords];// TODO: fill the wordBank through input using cin
// set up discovery vectorvector discovered;// Search for WordssearchPuzzle(puzzle, wordBank, discovered, numRows, numWords);// Sort the resultssort(discovered.begin(), discovered.end());// Print vector of discovered wordsprintVector(discovered);return 0;}// TODO: implement searchPuzzle and any helper functions you wantvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords){}// TODO: implement printVectorvoid printVector(const vector &v){}
// Search for WordssearchPuzzle(puzzle, wordBank, discovered, numRows, numWords);
// Sort the resultssort(discovered.begin(), discovered.end());
// Print vector of discovered wordsprintVector(discovered);
return 0;}
// TODO: implement searchPuzzle and any helper functions you wantvoid searchPuzzle(const char puzzle[][numCols], const string wordBank[],vector &discovered, int numRows, int numWords){}// TODO: implement printVectorvoid printVector(const vector &v){}
// TODO: implement printVectorvoid printVector(const vector &v){}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here