Question: Please paste your code and screenshot of output Codes below: COPY FILE // File: CopyFile.cpp // Copies file InData.txt to file OutData.txt #include // for
Please paste your code and screenshot of output

Codes below:
COPY FILE
// File: CopyFile.cpp
// Copies file InData.txt to file OutData.txt #include// for the definition of EXIT_FAILURE #include // required for external file streams #include using namespace std; // Associate stream objects with external file names #define inFile "InData.txt" #define outFile "OutData.txt" // Functions used ... // Copies one line of text int copyLine(ifstream&, ofstream&); int main() { // Local data ... int lineCount; // output: number of lines processed ifstream ins; // ins is as an input stream ofstream outs; // outs is an output stream // Open input and output file, exit on any error. ins.open(inFile); // connects ins to file inFile if (ins.fail ()) { cerr ; // the last character written to outs is . // Returns: The number of characters copied. int copyLine (ifstream& ins, // IN: ins stream ofstream& outs) // OUT: outs stream { // Local data ... const char NWLN = ' '; // newline character char nextCh; // inout: character buffer int charCount = 0; // number of characters copied // Copy all data characters from stream ins to // stream outs. ins.get(nextCh); while ((nextCh != NWLN) && !ins.eof()) { outs.put(nextCh); charCount++; ins.get (nextCh); } // end while // If last character read was NWLN write it to outs. if (!ins.eof()) { outs.put(NWLN); charCount++; } return charCount; } // end copyLine
Countchars code:
// File: CountChars.cpp // Counts the number of characters and lines in a file #include#include using namespace std; #define ENDFILE "CTRL-Z" int main() { const char NWLN = ' '; // newline character char next; // next character in current line int charCount; // number of characters in current line int totalChars; // count of total characters int lineCount; // keeps track of number of lines in file lineCount = 0; totalChars = 0; cout Task 0: Download and run countChars.cpp and copyFile.cpp, try to understand the code. MyData.txt (rather than from the keyboard). Also display the total number of characters and total lines in the file including the newline characters. Remember you do not need to write in an another external file (copy file), simply display total number of characters and total lines from the MyData.txt file. What and how to submit: When you are done and testing is successful, show your work to your instructor. If your instructor says OK, upload your cpp file and screenshot of your sample Input and output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
