Docsity

Statement - Computers and Programming I - Home Work, Lecture notes of Computer Programming

Toggle sidebar
bg1
Question 1
Assume that the following statement applies to a program.
Write a statement that opens file โ€œoldmast.datโ€ for input; use ifstream object
inOldMaster.
Question 2
Assume that the following statement applies to a program.
Write a statement that opens file โ€œtrans.datโ€ for input; use ifstream object
inTransaction.
Question 3
Assume that the following statement applies to a program.
Write a statement that opens file โ€œnewmast.datโ€ for output; use ofstream
object outNewMaster.
Question 4
Assume that the following statement applies to a program.
pf3

Partial preview of the text

Download Statement - Computers and Programming I - Home Work and more Lecture notes Computer Programming in PDF only on Docsity!

Question 1 Assume that the following statement applies to a program. Write a statement that opens file โ€œ oldmast.dat โ€ for input; use ifstream object inOldMaster.

Question 2 Assume that the following statement applies to a program. Write a statement that opens file โ€œ trans.dat โ€ for input; use ifstream object inTransaction.

Question 3 Assume that the following statement applies to a program. Write a statement that opens file โ€œ newmast.dat โ€ for output; use ofstream object outNewMaster.

Question 4 Assume that the following statement applies to a program.

Write a statement that reads a record from the file โ€œ oldmast.dat โ€. The record consists of integer accountNum , string name and floating-point currentBalance ; use ifstream object inOldMaster..

Question 5 Assume that the following statement applies to a program. Write a statement that reads a record from the file โ€œ trans.dat โ€. The record consists of integer accountNum , floating-point dollarAmount ; use ifstream object inTransaction.

Question 6 Assume that the following statement applies to a program. Write a statement that writes a record to the file โ€œ newmast.dat โ€. The record consists of integer accountNum , string name , and floating-point currentBalance ; use ofstream object outNewMaster.

Question 7

Write a program that uses the sizeof operator to determine the sizes in bytes of the various data types on your computer systems. Write the results to the file โ€œ datasize.dat โ€ so you may print the results later. The format for the results in the file should be

Date type Size