--Create a text file named employee.txt containing the following data: Anthony A
ID: 3642122 • Letter: #
Question
--Create a text file named employee.txt containing the following data:Anthony A 10031 7.82 12/18/2008
Burrows W 10067 9.14 06/9/2006
Fain B 10083 8.79 05/18/2007
Janney P 10095 10.57 09/28/2008
Smith G 10105 8.50 12/20/2007
--Write a C++ program to read the employee.txt file created in (a) and produce a duplicate copy
of the file. Your program should accept the name of the original file and the name of the duplicate file
to be created as input from the user, and perform all the necessary checks to ensure that it program will
exit smoothly in case a problem is encountered.
Explanation / Answer
#include #include #include using namespace std; int main() { FILE * input; FILE * output; char c; int n = 0; string in; string out; coutin; coutout; output=fopen (out.c_str(),"w"); input = fopen (in.c_str(),"r"); do { c = fgetc (input); fputc ( c , output ); }while (c != EOF); }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.