Question: Description: In this homework, you will implement reading & writing to files and passing by reference. Problem: You will be given a list of words




Description: In this homework, you will implement reading & writing to files and passing by reference. Problem: You will be given a list of words in a file. You must then replace all words that start with any of the characters in a list (from command line args). Finally, you will output the changed list to a file. You will be reading your arguments from the command line. The name of the input file will be passed into your program as argument 1, argv[1]. The name of the output file will be passed into your program as argument 2, argv [2]. The number of words will be passed into your program as argument 3, argv [3]. The letters to replace will be passed into your program as argument 4, argv [4] You must create an array called words, then you must read the contents of this file into it. You must use the function: void readFile (string fileName, string words []) Then for every character in the list of characters, replace all words that start with the that character. These words will be replaced with four dashes, You must use the function: void replaceWord(string &word, char toReplaceInWord) Then you must write the array words to file in. You must use the function: void writeFile (string fileName, string words[], int numberOfWords)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
