Question

14.3 Assume that each of the following statements applies to the same program. a) Write a statement that opens file oldmast.d

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment....

a)

ifstream inOldMaster.open("oldmast.dat");

b)

ifstream inTransaction.open("trans.dat");

c)

ofstream outNewMaster.open("newmast.dat");

d)

inOldMaster>>accountNumber;

inOldMaster.clear();

inOldMaster.ignore(4096, '\n');

getline(inOldMaster, name);

inOldMaster>>currentBalnce;


e)

inTransaction>>accountNum>>dollarAmount;

f)

outNewMaster<<accountNum<<endl;

outNewMaster<<name<<endl;

outNewMaster<<currentBalance<<endl;

Add a comment
Know the answer?
Add Answer to:
14.3 Assume that each of the following statements applies to the same program. a) Write a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This program has an array of floating point numbers as a private data member of a...

    This program has an array of floating point numbers as a private data member of a class. The data file contains floating point temperatures which are read by a member function of the class and stored in the array. Exercise 1: Why does the member function printList have a const after its name but getList does not? Exercise 2: Fill in the code so that the program reads in the data values from the temperature file and prints them to...

  • Write a PYTHON program that reads a file (prompt user for the input file name) containing...

    Write a PYTHON program that reads a file (prompt user for the input file name) containing two columns of floating-point numbers (Use split). Print the average of each column. Use the following data forthe input file: 1   0.5 2   0.5 3   0.5 4   0.5 The output should be:    The averages are 2.50 and 0.5. a)   Your code with comments b)   A screenshot of the execution Version 3.7.2

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

  • Directions: You are to write a C++ program that meets the instruction requirements below. Deliverables: ·...

    Directions: You are to write a C++ program that meets the instruction requirements below. Deliverables: · Your C++ source code file. (The file with the .CPP extension). No other files will be accepted. A screenshot of your program running. Program Instructions: Consider the following incomplete C++ program: #include int main() { … } 1. Write a statement that includes the header files fstream, string, and iomanip in this program. 2. Write statements that declare inFile to be an ifstream variable...

  • Write the program in C The following statistics for cities of the Vege country are stored...

    Write the program in C The following statistics for cities of the Vege country are stored in a file: Name: a string of characters less than 15 characters long. Population: an integer value. Area: square miles of type double Write a program that: asks and gets the name of the input file from the user. Read the contents of the file into an array length 10 of structures -ask the user for the name of a city (less than 15...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • /* BEGIN - DO NOT EDIT CODE */ // File: main.cpp #include "LoginAccount.h" #include "RegisteredLoginAccount.h" #include...

    /* BEGIN - DO NOT EDIT CODE */ // File: main.cpp #include "LoginAccount.h" #include "RegisteredLoginAccount.h" #include "GuestLoginAccount.h" #include <iostream> #include <fstream> #include <string> #include <sstream> using namespace std; //prototypes and constants const int ARRAY_SIZE = 20; using number_of_records_t = int; //Function Declarations. void readAccountsFromFile(ifstream& fin, RegisteredLoginAccount registeredAccounts[], number_of_records_t& registeredLength, GuestLoginAccount guestAccounts[], number_of_records_t& guestLength); bool openFileForInput(ifstream& ifs, const string& filename); bool openFileForOutput(ofstream& ofs, const string& filename); void writeAccountsToFile(ofstream& ofs, RegisteredLoginAccount registeredAccounts[], const number_of_records_t registeredLength, GuestLoginAccount guestAccounts[], const number_of_records_t guestLength); void writeAccountToFile(ofstream&...

  • Course, Schedule, and ScheduleTester (100%) Write a JAVA program that meets the following requirements: Course Class Cr...

    Course, Schedule, and ScheduleTester (100%) Write a JAVA program that meets the following requirements: Course Class Create a class called Course. It will not have a main method; it is a business class. Put in your documentation comments at the top. Be sure to include your name. Course must have the following instance variables named as shown in the table: Variable name Description crn A unique number given each semester to a section (stands for Course Registration Number) subject A...

  • QUESTION 6 To determine whether a file was opened successfully, the program can use the fstream...

    QUESTION 6 To determine whether a file was opened successfully, the program can use the fstream function: Hint: google fail() open() close() eof() 10 points    QUESTION 7 Which of the following are correct ways to end a loop using a test for end-of-file? (Two correct answers) inStream.get(next); while(!inStream.eof( )) { cout << next; inStream.get(next); } while(inStream->next)   { cout << next; } inStream.get(next) while(!eof(inStream)) { cout << next; inStream.get(next); } while(inStream >> next)   cout << next; 10 points    QUESTION...

  • C++ Homework Help: The text file that it wants you to download is this: Name: Peter...

    C++ Homework Help: The text file that it wants you to download is this: Name: Peter Parker CSCI-261: 95 CSCI-262: 90.625 CSCI-442: 91.20 Name: Mary Smith CSCI-442: 65.0 CSCI-562: 79.1234 CSCI-580: 70.24 Name: Pat Brown CSCI-562: 95 CSCI-565: 88.0 CSCI-580: 91.20 Name: Linda Williams CSCI-262: 65.0 CSCI-306: 67.719 CSCI-562: 70.200 Name: John Miller CSCI-261: 95.281 CSCI-306: 90.625 CSCI-565: 91.20 Name: Patricia Johnson CSCI-306: 65.012 CSCI-442: 84.76 CSCI-580: 70 Name: Brian Hall CSCI-261: 65.0 CSCI-306: 84.712 CSCI-442: 75.24 Name: Sandra Nelson...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT