int main(){
ifstream infile;
ofstream outfile;
string words[k]; //this is the array that the words from the infile will be stored in
char thegrid[r][c]; //this is the multideminsional array that will store the actuall word search
cout<<"welcome to the Word Finder Generator\n\n";
getfile(infile); //gets the infile from the user
populatearray(infile, words); //uses that file to fill words[]
infile.close();
system("CLS");
fillgrid(thegrid); //fills thegrid[][] with '.'
displaygrid(thegrid); //manages the modules that print thegrid[][]
placeword(words, thegrid); //manages the modules that test and place the words where the user specifies
cout<< "The puzzle is complete.\n";
system("pause");
CompletePuzzle(thegrid); //Fills in all the left over '.' chars in thegrid[][] after the user has placed the words
displaygrid(thegrid);
getfile2(outfile); //gets the file from the user that the puzzle will be stored in
PutPuzzleAway(thegrid, words, outfile); //stores thegrid[][] in the file earlier specified
outfile.close();
return 0;
}
void getfile2(ofstream& outfile)
{
//takes ofstream outfile by refrence and opens the
//file the user wishes to put the puzzle into
string filename;
cout<<"\n\nPlease enter the name of the file you would like to put the puzzle in: ";
cin >> filename;
outfile.open(filename.c_str());
return;
}
void PutPuzzleAway(constchar grid[][c], string words[], ofstream& outfile)
{ //the last module to be executed
// takes thegrid[][] and the ofstream outfile
//prints grid[][] into the outfile
int j, k, i; //counters
for (j=0;j<c;j++){
for(k=0;k<r;k++)
outfile<<grid[j][k];
outfile<<endl;
}
for(i=0;i<k;i++)
outfile<<words[i]<<endl;
}
basically i get through the entirety of the execution i enter the name of the outfile and it tells me the program has stopped responding... This is like no error i have ever gotten while writing in c++ and i am confused as to what could be MCVS 2010 doesnt give me an error or warning message what do you guys think?