Question: Consider the following program that should read in 1024 words (strings) from a file into an array, and returns the array to main which
Consider the following program that should read in 1024 words (strings) from a file into an array, and returns the array to main which then outputs 512 strings. The 512 strings should be the result of concatenating the first and last, second with second to last, third with the third to last, etc. Fill in the indicated blanks below (return type, array allocation, words declaration, cout code, and cleanup). #include #include using namespace std; // This function reads 1824 words from the given file // fill in the return type below readDict(char* f) { ifstream inFile(f); // allocate an array 's' of 1024 strings string for (int i-0; i > s[i]; } return s; }//readDict() int main() { // Indicate the type of words below words= readDict("dict.txt"); for(int k = 0; k < 512; K++){ cout < words[k] } // now we're done working with the words // Show any cleanup code you need here (if any) return 0;
Step by Step Solution
3.34 Rating (154 Votes )
There are 3 Steps involved in it
Answer Certainly Below is the corrected and completed version of your program include include using ... View full answer
Get step-by-step solutions from verified subject matter experts
