I traduced the program to English so you guys can understand it better. |
Thanks for that. It really does make it easier to read. (traduced should be translated, by the way.)
In quite a few places you're using the construct:
while (getline(inFile, string1).good ())
which should be:
while (getline(inFile, string1))
It is possible that getline encounters the end of file while reading from the file, but is still successful at extracting a string from the file. good() will return false if eof has been encountered.
deleteText and replaceText don't work. If you choose to viewText after executing deleteText you will see that the file is unchanged. If you choose to viewText after executing replaceText you will see that the text has not been replaced, unless it happens to be at the very beginning of the file and the replacement text happens to be exactly the same length as the text to be replaced.
Typically when you modify a text file, you want to:
-open the file and read all of the contents in.
-close the file
-make any changes to the contents.
-reopen the file for output (truncating the file)
-write the contents back to the file.
-close the file.
As far as making the dictionary goes, use a container. Read the file word by word. If the word isn't already in the container, search the container for the word. If the word isn't in the container, put it in.