5. Mary Conrad wants a program that allows her to save each letter of the alphabet and an associated word starting with the same letter of the alphabet on each line in a sequential access file
Example:
A apple
B button
She will enter the information from the keyboard. Assuming that the file name is alphabetChart.txt.
Write the corresponding C++ program.
As you're saving to file, I'm not sure why you're calling your file stream inputData.
The obvious thing to do is open the output file.
Read the input in from std::cin, and write it to the output file.
That's what the requirements call for.
There is no reason to redirect stdout/std::cout.
Fredbill30 wrote:
After you open inputData, assuming it's an ofstream object, you'd do this:
File streams are closed automatically when they go out of scope.