C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 8.2, Problem 5E

a.

Program Plan Intro

Program Plan:

  • 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 Intro

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 Intro

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.

Program Plan Intro

To find the better method for accepting the original and duplicate filenames in the program.

Blurred answer
Students have asked these similar questions
(3c) In the following resource allocation graph, is the state a deadlocked one? If so which ones are deadlocked? (3 points) Resource allocation graph. R₁ = Resource, P = process. R1 R3 R3 7
What resources are used when a thread is created? How do these differ from those used when a process is created?
(c) Consider the following set of processes: Process ID Arrival Time Priority Burst Time A 2 3 100 B 6 C 10 1 (highest) 2 40 80 D 16 4 (lowest) 20
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr