How would I be able to find certain words in a word search given in a specific file. The words are also stored in another file. Here is the code I have so far:
Code:#include<iostream> #include<iomanip> #include<fstream> #include<conio> #include<string> #include<cstring> using namespace std; void FileCheck(ifstream&, char[]); void ReadWMatrix(ifstream&, char wmatrix[25][25]); void ReadWords(ifstream&, string words[25]); void PrintOut(char wmatrix[25][25], string words[25]); int main() { ifstream input; char wmatrix[25][25]; string words[25]; ReadWMatrix(input, wmatrix); ReadWords(input, words); PrintOut(wmatrix, words); return 0; } /*******************************************************/ void FileCheck(ifstream& In,char Name[]) { do { cout << "File not found\n"; cout << "Enter File Name >"; cin >> Name; In.open(Name); } while (In.fail()); } /*******************************************************/ void ReadWMatrix(ifstream& input, char wmatrix[25][25]) { input.open("wmatrix.dat"); while(!input.eof()) { for(int i=0; i<19; i++) for(int j=0; j<21; j++) input >> wmatrix[i][j]; } input.close(); } /*******************************************************/ void ReadWords(ifstream& input, string words[25]) { input.open("words.dat"); while(!input.eof()) { for (int i=0; i<25; i++) input >> words[i]; } input.close(); } /*******************************************************/ void PrintOut(char wmatrix[25][25], string words[25]) { for(int i=0; i<19; i++) { for(int j=0; j<21; j++) cout << wmatrix[i][j]; cout << endl; } for(int i=0; i<25; i++) { cout << words[i]; cout << endl; } }



LinkBack URL
About LinkBacks


