|
|
Program 6 - February 14File I/OFor a change - an assignment out of the book! Write the program described in our text (Savitch, 3rd edition)
on page 295: Programming Project # 12. This is the project that reads and makes
minor corrections to a C++ program. For full credit, do what the author calls
the "harder" version. That is, you should recognize all of the
following and correct them: Hint: Look up the isspace function.Additions to the TextYour program should allow the user to input the name of the input file as we discussed in class. For the output file, you can either use a hard coded name or have the user input that as well. Be sure to display an error message if the input file cannot be found. SuggestionsThe best approach is probably to process a word at a time BUT we
haven't studied enough about strings to do that cleanly. You will probably have
to do it one character at a time. The easiest way to do that is to use a
variable that "remembers" what you are looking for. For example: You can also do it by having a completely different piece of code for each state of the program. Ask questions about this on Wednesday, and I'll outline the approach in a little more detail. Sample FilesI'll have sample input and output files on the FTP site later this week.
|
|
Copyright © 2000 Charlie Poole. All rights reserved.
|