Create a file called pp6ainput.dat and type one integer


Problem

Create a file called pp6ainput.dat and type one integer in it, 55. Compile and execute pp6a.cpp. Check to see if you now have a file called pp6aoutput.dat that has the words "The number is: 55". Add code to pp6a.cpp to do the following:

I. Read multiple integers from input.dat and write them to output.dat until the end of the input.dat file. Edit input.dat and put several integers in it. Execute this program and take a screen shot of output.dat.

II. Ask the user for the name of the input file and check to see if it exists. If it does not, print the error message "File xxxx does not exist" where xxxx is the name of the file. If it does exist, ask the user for the name of the output file, read numbers from the input file and write them to the output file until the end of the input file. Do not ask the user for the name of the output file if the input file does not exist. Follow the test instructions and take a screen shot of this code executing.

III. Check to make sure the input file isn't empty. If it is empty, print the error message "File xxxx is empty." where xxxx is the name of the file. If it is non-empty, ask the user for the name of the output file, read numbers from the input file and write them to the output file until the end of the input file. Do not ask the user for the name of the output file if the input file is empty. Follow the test instructions and take a screen shot of this code executing.

IV. Write the output as dollar amounts by writing two small functions. The first reads the number from the input file. It has two parameters, the ifstream and the number. The post-condition is that the actual parameters are changed. The second writes the number to the output file formatted as a dollar amount, such as $123.45, with a $ and exactly 2 digits to the right of the decimal. It also has two parameters, an ofstream, whose actual parameter is changed in the course of writing, and the number to be written. Follow the test instructions and take a screen shot of the code executing AND of the contents of output.dat after the program executes.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Create a file called pp6ainput.dat and type one integer
Reference No:- TGS03331579

Expected delivery within 24 Hours