Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

So basically I need to recursively write a function in C++ that will go into a .

ID: 3857090 • Letter: S

Question

So basically I need to recursively write a function in C++ that will go into a .txt file and do the following:

int readDictionary(istream &dictfile, string dict[]);

Places each string in dictfile into the array dict. Returns the number of words read into dict. This number should not be larger than MAXDICTWORDS since that is the size of the array.

MAXDICTWORDS is the maximum number of words in my words.txt file which is 3000.

Explanation / Answer

#include #include #include #include using namespace std; const int Size = 17; // 16 characters for the line + 1 for the '' const int MaxNumberOfWords = 253633; // maximum number of words to be stored int main() { ifstream inStream; // declare an input stream for my use char theWords[MaxNumberOfWords][ Size]; // Array to store words from input line int wordRow = 0; // Row for the current word inStream.open( "dictionary.txt"); assert( ! inStream.fail() ); // make sure file open was OK // Keep repeating while input from the file yields a word while (inStream >> theWords[wordRow]) wordRow++; // Go through the array of words, displaying each one in turn. // Note that we only display the words read, not the empty array // rows. cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote