Consider the following program that should read in 1024 words (strings) from a file into an...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 <iostream> #include <fstream> 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<1024; ++) { inFile >> 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; <<endl; 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 <iostream> #include <fstream> 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<1024; ++) { inFile >> 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; <<endl;
Expert Answer:
Answer rating: 100% (QA)
Answer Certainly Below is the corrected and completed version of your program include include using ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
What can you do with your social media profile (LinkedIn) to establish your credibility as an industry sales Professional? Include not only the different steps you would take but also 1-2 examples of...
-
List the directors duties in respect of going concern basis.
-
On March 5, 2020, you were hired by Hemingway plc, a closely held company, as a staff member of its newly created internal auditing department. While reviewing the company's records for 2018 and...
-
Fourthedition Township is issuing a 30-year bond with a face value of $ 50,000,000 and a stated annual interest rate of 4 percent. The city will make interest payments twice a year. 1. Calculate the...
-
What elements must be proven in order to be successful in a negligence suit? Illustrate your answer with a case (the facts of the case can be hypothetical).
-
Bloom Company management predicts that it will incur fixed costs of $160,000 and earn pretax income of $164,000 in the next period. Its expected contribution margin ratio is 25%. Use this information...
-
Madox Max Ltd pay a dividend of $3.3 per share next year. After that the dividend is forecast to grow at 15% for 1 year. From year three onwards dividends are expected to grow by 6% indefinitely....
-
Nutrition is often talked about in everyday pop culture. Nutrition science, however, is not always part of the conversation. Respond to the following in a minimum of 175 words: Discuss some examples...
-
3. (15 marks) Six buildings need to be connected by fibre-optic cable. The follow- ing symmetric table gives the distance in metres of running a direct cable between buildings. From/To 1 2 3 4 5 6 1...
-
Comment on the free rider problem in the context of global climate agreements. How does recent historical experience with the Kyoto Treaty and the Paris Agreement relate to this problem?
-
Americans are split on the subject of school vouchers, and the controversy especially affects communities with disproportionate numbers of poor families. Some leaders in these communities strongly...
-
In 2017, partial repeal of the Affordable Care Act was enacted by Congress as a part of a larger tax reform package that made many substantial changes to the tax code. Why does the manner in which it...
-
U.S. law prohibits hospitals from denying patients care in an emergency, even if they are unable to pay. Historically, the cost of covering these uninsured patients has been passed on to insured...
-
______________ are principles or guidelines that support an organizational mission or goal.
-
How many silver atoms are contained in 3.75 moles of silver? (Show work on scratch paper) O 2.44 x 1026 silver atoms O 1.61 x 1023 silver atoms O 2.26 x 1024 silver atoms O 6.23 x 1024 silver atoms...
-
Chris Zulliger was a chef at the Plaza Restaurant in the Snowbird Ski Resort in Utah. The restaurant is located at the base of a mountain. As a chef for the Plaza, Zulliger was instructed by his...
-
Construct logical expressions to represent the following conditions: a. weight is greater than or equal to 115 but less than 125. b. ch is q or Q. c. x is even but is not 26. d. x is even but is not...
-
Revise the following short program so that it uses a lambda expression instead of f1(). Dont change show2(). #include template void show2(double x, T& fp) {std::cout < < x < < " -> " < < fp(x) < < '...
-
Write a statement that displays the value of the second element in the float array ideas.
-
Figure 4.11 shows the \(v_{x}(t)\) curves for a collision between two identical carts moving not on a low-friction track but rather on a rough surface, so that friction affects their motion. Are the...
-
(a) Classify and give examples of the kinds of processes that can change (i) the number of loaves of bread in a bakery, (ii) the number of Lego pieces inside a house, and (iii) the number of coins in...
-
Cite at least two possible choices of system in each of the following situations. For each choice, make a sketch showing the system boundary and state which objects (excluding air) are inside the...
Study smarter with the SolutionInn App