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.5, Problem 5E

(a)

Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare object of ofstream.
  • Create a file named “gradeUpdate.dat” to write contents.
  • Use if statement with fail() method to check that the entered file name is available or not.
  • Read data from the program and write data to the file.
  • int main() function is used to perform all the task.
  • Display the calculated results to the user.

Program Description: The main purpose of this program is to create the “gradeUpdate.dat” file and to store the given data in the file.

(b)

Program Plan Intro

Program Plan:

  • Include library files for various operations.
  • Declare twoobjects ofofstream and ifstream.
  • Open both the given file “grades.dat” and “gradeUpdate.dat”.
  • Use if statement with fail() method to check that the file name is available or not.
  • Use arrays, for retrieving the data per row from the file to generate the student record.
  • Convert the string values from the arrays to the integer values for manipulations.
  • Calculate the total credits and GPA obtained by each student.
  • int main() function is used to perform all the task.
  • Display the calculated results to the user.

Program Description: The main purpose of this program is toupdate the “gradeUpdate.dat” file created in part (a ) by using the “gardes.dat” file created in the previous question.

Blurred answer
Students have asked these similar questions
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
(3e) Test-and-Set. The Test-and-Set instruction is used in hardware to achieve synchronization. It can be defined in the following way: function Test-and-Set (var target: boolean): boolean; begin Test-and-Set:= target; target := true; end; Now show how the Test-and-Set instruction can be used to protect a critical region and hence achieve mutual exclusion (do not worry about satisfying the bounded waiting condition). (8 points) repeat
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