a.
- Include library files for various operations.
- Declare object ofofstream.
- Create a statement to open the write data to the file “employee.dat”.
- Use if statement with fail() method to check that the entered file name is available or not.
- int main() function is used to perform all the task.
- Display the calculated results to the user.
Program Description: The main purpose of the program is to create a text file, “employee.dat” and to write the given data to the file.
b.
Program Plan:
- Include library files for various operations.
- Declare objects ofifstream and ofstream.
- Declare required variable.
- Create two statements to open “employee.dat” and “employee.bak” file.
- Use if statement with fail() method to check that the entered file name is available or not.
- int main() function is used to perform all the task.
- Display the calculated results to the user.
Program Description: The main purpose of the program is to modify the program code of part (a) so that the program code can create a duplicate copy of the text file with the name “employee.bak”, that contains all the data of “employee.dat” file.
c.
Program Plan:
- Include library files for various operations.
- Declare objects ofifstream and ofstream.
- Declare required variable.
- Read file names from the user.
- Create two statements to open “employee.dat” and “employee.bak” file.
- Use if statement with fail() method to check that the entered file name is available or not.
- int main() function is used to perform all the task.
- Display the calculated results to the user.
Program Description: The main purpose of the program is to modify the program code of part (b)so that the program code will read the name of the original and duplicate file from the user, creates a duplicate copy of the text file with name “employee.bak”, that contains all the data of “employee.dat” file.
d.
To find the better method for accepting the original and duplicate filenames in the program.
Trending nowThis is a popular solution!
Chapter 8 Solutions
C++ for Engineers and Scientists
- 1)Use c code to add the function in the program to provide for purchase amount of RM80.00 or more, the delivery charge is waived and for purchase amount of RM100 or more, a 15% discount is given.arrow_forwardUrgent need in 10 min..otherwise i give you dislike. Write C# Program to Copy a Section of One Array to Another.arrow_forwardC++ program chose the correct result for each of the following programming statementsarrow_forward
- -Convert SES variable to a factor and assign the value labels “low”, ”middle” and “high” to the 3 levels of thevariable. Then -Define the variables complic, comorb, depressi, diabetes as factors. For all these factors, a zero means “no” and a 1 means “yes”. Assign these value labels through the function factor() and check the change using str()arrow_forwardInclude the Output pleasearrow_forward(8).Continue Print (*,*) X.arrow_forward
- (Practice) Run Program 7.10 to determine the average and standard deviation of the following list of 15 grades: 68, 72, 78, 69, 85, 98, 95, 75, 77, 82, 84, 91, 89, 65, and 74.arrow_forwardFor the following, the C++ programs must... - Take a single command-line argument representing the input file name, - Process the input file name, and - Write to standard outputarrow_forwardProduce the following program.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning