Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

Students also viewed these Databases questions