Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Answer Certainly Below is the corrected and completed version of your program include include using ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started