Question: C++ programming Assignment 2 Direction: Submit the typed source code. Cat Command For this assignment, you will copy a file's content and display it; which
Assignment 2 Direction: Submit the typed source code. Cat Command For this assignment, you will copy a file's content and display it; which is, similar to the cat command on Linux, Your program should consist of the following function along with the main function: Function Name: CopyFi1e) Parameter(s): Return: string It should try to open the file, filename, for reading. If the file does not open or does not exists, return an empty string. Otherwise, copy the file to a string and return the string. In the main function, 1. prompt the user to enter a filename. 2. call the CopyFi1e) with the user's input as the argument. 3. display the file's content if the file opened The following is an example of a possible output: msg.txt Enter a filenane: msg.txt The race is not to the swift, nor the battle to the strong, nor bread to the vise, nor riches to the intelligent, nor favor to those vith knowledge, but time and chance happen to them all The race is not to the swift, nor the battle to the strong, nor bread to the vise, nor riches to the intelligent . nor favor to those vith knovledge, but tine and chance happen to them all
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
