I'm having a bit of trouble (surprise surprise). I'm trying to write a program that will prompt the user for the word to search for and the word to use as a replacement. The program should then replace all of the instances of the target word with the replacement word.
heres a sample of the input file:
A sample run of the program:Code:red yellow orange purple green yellow green purple white purple
Please input a word to search and a new word to replace
The file will then update to:
Code:red yellow orange blue green yellow green blue white blue
I tried writting a program that loaded the file into an array and then compare each array value to the words searched...if they matched then it replaced it...if not it went to the next one...
My question is... was that the right logic or was I trying to do something that was impossible. If I'm wrong...what should I do to make it right
(*note* no code is needed....just gentle nudges toward an answer)
I'll post my code if needed/wanted