Question: Write in C++ a main file that uses argc and argv to implement the function below. The program should read from input.txt and write to

Write in C++ a main file that uses argc and argv to implement the function below. The program should read from input.txt and write to output.txt.

Both functions will read from a file named "io_file.txt"

get_word: The first function should be called "get_word". It takes two arguments. Every call to this function will fill one of the arguments with a word from the file. You should then output every word you receive and a count of the total number of words to a file specified by the user on the command line. This function doesn't return anything.

get_line: The second function will implement istream::getline functionality and should be called "get_line". It also takes two arguments. Every call to this function will read an entire line in from the file, filling one of its arguments with an entire line from the file. You should then output the data saved in the argument to a file specified by the user on the command line. This function doesn't return anything.

All output should occur inside of the main function (that is, your get_word/get_line don't output anything themselves).

Both functions have void for a return type.

The program is run as follows:

./a.out # input_file.txt output_file.txt

where # is either 1 or 2 and selects between which function to run.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!