STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13, Problem 18RQE
The ______ member function reports when the end of the file has been encountered.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Fill-in-the-Blank
The __________ member function reports when the end of the file has been encountered.
Function ________repositions the file position pointer to a specific location in the file
C programming language
Criteria graded:
Declare file pointers Open file Read from file Write to file Close file
Instructions:
Write a segment of code that opens a file called “numbers.txt” for reading. This file is known to have 10 numbers in it. Read in each number and print a ‘*’ to the screen if the number is even. If the number is odd, do nothing. Conclude by closing this file.
Chapter 13 Solutions
STARTING OUT WITH C++ MPL
Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - Name three different C++ classes that can be used...Ch. 13.1 - What is the purpose of the second parameter to the...Ch. 13.1 - Why is it important for a program to close an open...Ch. 13.1 - Which file open flag causes all output to take...Ch. 13.1 - Which file open flag causes the contents of an...Ch. 13.1 - What happens if ios: :out is used by itself to...Ch. 13.1 - What happens if ios::out is used by itself to open...Ch. 13.1 - Write a sequence of C++ statements that reads in...Ch. 13.1 - Write a sequence of C++ statements that reads in...
Ch. 13.1 - Show how to use the constructor of the fstream...Ch. 13.1 - Consider two parallel arrays of the same size, one...Ch. 13.3 - Make the required changes to the following program...Ch. 13.3 - Describe the purpose of the eof member function.Ch. 13.3 - Assume the file input.txt contains the following...Ch. 13.3 - Describe the difference between reading a file...Ch. 13.3 - Describe the difference between the getline...Ch. 13.3 - Describe the purpose of the put member function.Ch. 13.3 - What will be stored in the file out.dat after the...Ch. 13.3 - The following program skeleton, when complete,...Ch. 13.5 - Write a short program that opens two files...Ch. 13.5 - How would the number 479 be stored in a text file?...Ch. 13.5 - Describe the differences between the write member...Ch. 13.5 - What arc the purposes of the two arguments needed...Ch. 13.5 - What are the purposes of the two arguments needed...Ch. 13.5 - Describe the relationship between fields and...Ch. 13.5 - Prob. 13.27CPCh. 13.7 - Describe the difference between the seekg and the...Ch. 13.7 - Describe the difference between the tellg and the...Ch. 13.7 - Describe the meaning of the following file access...Ch. 13.7 - What is the number of the first byte in a file?Ch. 13.7 - Briefly describe what each of the following...Ch. 13.7 - Describe the mode that each of the following...Ch. 13 - Prob. 1RQECh. 13 - Before a file can be used, it must first beCh. 13 - When a program is finished using a file, it shouldCh. 13 - The__________ header file is required for file I/O...Ch. 13 - Prob. 5RQECh. 13 - The_____________ file stream data type is for...Ch. 13 - The____________ file stream data type is for input...Ch. 13 - The ______ file stream data type is for output...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write a statement that defines a file stream...Ch. 13 - Write two statements that use the people file...Ch. 13 - Write two statements that use the pets file stream...Ch. 13 - Write two statements that use the places file...Ch. 13 - If a file fails to open, the file stream object...Ch. 13 - Write a program segment that defines a file stream...Ch. 13 - The same formatting techniques used with ______...Ch. 13 - The ______ member function reports when the end of...Ch. 13 - The ______ function reads a line of text from a...Ch. 13 - The _______ member function reads a single...Ch. 13 - The _____ member function writes a single...Ch. 13 - Prob. 22RQECh. 13 - Prob. 23RQECh. 13 - Prob. 24RQECh. 13 - In C++, _______ provide a convenient way to...Ch. 13 - The _______ member function writes raw binary data...Ch. 13 - The _______ member function reads raw binary data...Ch. 13 - The ______ operator is necessary if you pass...Ch. 13 - In _______ file access, the contents of the file...Ch. 13 - In _____ file access, the contents of a file may...Ch. 13 - The _______ member function moves a files read...Ch. 13 - The ______ member function moves a files write...Ch. 13 - The _______ member function returns a files...Ch. 13 - The _______ member function returns a files...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to be...Ch. 13 - The ______ mode flag causes an offset to he...Ch. 13 - A negative offset causes the files read or write...Ch. 13 - Give a pseudocode algorithm for determining the...Ch. 13 - Give a pseudocode algorithm for comparing two...Ch. 13 - Prob. 41RQECh. 13 - Suppose that you have two text files that contain...Ch. 13 - Each of the following programs or program segments...Ch. 13 - File Previewer Write a program that asks the user...Ch. 13 - File Display Program Write a program that asks the...Ch. 13 - Punch Line Write a program that reads and prints a...Ch. 13 - Tail of a File Write a program that asks the user...Ch. 13 - String Search Write a program that asks the user...Ch. 13 - Sentence Filter A program that processes an input...Ch. 13 - File Encryption Filter File encryption is the...Ch. 13 - File Decryption Filter Write a program that...Ch. 13 - Letter Frequencies The letter e is the most...Ch. 13 - Put It Back C++ input stream classes have two...Ch. 13 - Prob. 11PCCh. 13 - Insertion Sort on a File II Modify the program...Ch. 13 - Prob. 13PCCh. 13 - Prob. 14PCCh. 13 - Inventory Program Write a program that uses a...Ch. 13 - Inventory Program Write a program that uses a...Ch. 13 - Group Project 17. Customer Accounts This program...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The ________ object is assumed to exist and it is not necessary to include it as an object when referring to it...
Web Development and Design Foundations with HTML5 (8th Edition)
Write for statements that print the following sequences of values: 1, 2, 3, 4, 5, 6, 7 3, 8, 13, 18, 23 20, 14,...
C How to Program (8th Edition)
Consider the following code (and assume that it is embedded in a complete and correct program and then run): st...
Problem Solving with C++ (9th Edition)
The job of the _____ is to fetch instructions, carry out the operations commanded by the instructions, and prod...
Starting Out With Visual Basic (7th Edition)
What common programming language statement, in your opinion, is most detrimental to readability?
Concepts of Programming Languages (11th Edition)
Open the Chap3\ Error2\ Error2 project from the student sample programs folder. The application has an error. F...
Starting Out With Visual Basic (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Saving a Document as a Text File Create a function save_document() that accepts the arguments filename and text and saves the text into the file filename. The filename should use the name of the document with ‘_edited_document’ appended to it. For example, for the document text.doc, the save document should have the name text_edited_document.txt. The file should be saved in the folder “edits.” Assume that the folder already exists in the present working directory.arrow_forwardData File: Example #1AAAAABBBBBCCCCCDDDDDAAEBCBAFBBCDCECDADDEFEEFFFExample #2AAATAABTBBBBCCCCTCDDTDDDAASAABBSBBCCSCCDSDDDEEEAEEFBFFFDDF Write a program that will give the user a brief introduction, then allow the user to type in the name of the file to be analyzed, the name of the data file to generate, and then process the data to match the output that is shown below. This DNA test measures the various parts of the sequence and assigns them a letter. While the letters could be anything from A to Z, the only letters that matter for this test are the letters {A,B,C,D} all other letters can be ignored completely. A sample will be tested, given a length of time and then tested again. Each time the scientist will generate a line of data. Here is one Example: Example #1 AAAAABBBBBCCCCCDDDDD AAEBCBAFBBCDCECDADDEFEEFFF At first glance the sample looks significantly different after the second test. But if you look at the data, you will note that since we only care about A,B,C,D’s that the…arrow_forwardC++Inventory Program Write a program that uses a structure to store the following inventory data in a file: Item Description Quantity on Hand Wholesale Cost Retail Cost Date Added to Inventory The program should have a menu that allows the user to perform the following tasks: • Add new records to the file. • Display any record in the file. • Change any record in the file. Input Validation: The program should not accept quantities, or wholesale or retail costs, less than 0.The program should not accept dates that the programmer determines are unreasonable.arrow_forward
- Array/File FunctionsWrite a function named arrayToFile. The function should accept three arguments:the name of a file, a pointer to an int array, and the size of the array. The functionshould open the specified file in binary mode, write the contents of the array to the file,and then close the file.Write another function named fileToArray. This function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. Thefunction should open the specified file in binary mode, read its contents into the array,and then close the file.Write a complete program that demonstrates these functions by using the arrayToFilefunction to write an array to a file, and then using the fileToArray function to readthe data from the same file. After the data are read from the file into the array, displaythe array’s contents on the screen.arrow_forwardYou cannot create a shared pointer that does not reference an object. O True Falsearrow_forwardAnswer everythingarrow_forward
- Print Person Information from file In this lab you are asked to complete the function : print_person_from_file(person_name, filename). This function should read in data from the file filename and print the information for person_name if it is found in the file. The file filename contains lines, in comma separated format (with a 'csv' extension) For each line, the items in each field are as follows: Field 1 3 4 Name Place of Birth Date of Birth Children For Children: • a person can have 0, 1 or multiple Children Multiple children are semi-colon separated If a person has no children the field contains 'NA' For example, consider the following lines froma .csv file, where Fletcher_Margaret has 3 children, and Baker_Jill has 0 children (field 4 contains the string 'NA') Fletcher Margaret,Sydney,30-09-1921,Green Bob;Green Nancy;William Tom Baker_Jill, Melbourne,08-09-1973, NA Format for Printing If the person_name is found in the file, the format for printing the person information is as…arrow_forwardOption 2: Display the Record of a particular PatientWhen a user selects option 2, The main function prompts for and reads a PatientID. Then it calls the thefunction getPatient(patientID), which then searches for this PatientID in the text-file. If the Patient is notfound, an appropriate error message is displayed, otherwise; the Patient’s information is displayed. Inboth cases, the option waits for the Enter key to be pressed before returning control to the main menu.Please select your choice: 2Enter Patient ID: 1002Patient ID Patient Name Weight Ave. Weight Visits1002 Majed Sameer 18 .6 18 .2 2Press Enter key to continue . . .Please select your choice: 2Enter Patient ID: 1552Error: Invalid PatientPress Enter key to continue . . . Option 3: Display all Patient WeightIt prompts for- and reads a maximum weight from the user. Then it displays all patients with weight lessthan or equal to the give weight. Also, it displays the percentage weight increase (with a + sign) ordecrease (with a…arrow_forward1. Creating Employee Data ( Page 625)Create an application that allows the user to enter the following employee data: First Name, Middle Name, Last Name, Employee Number, Department, Telephone Number, Telephone Extension, and E-mail Address. The valid values for department are Accounting, Administration, Marketing, MIS, and Sales. Once the data is entered, the user should be able to save it to a file. Figure 9-30 shows an example of the application’s form. The form shown in Figure 9-30 has a combo box for selecting the department; a Save Record button, which writes the record to a file; a Clear button, which clears the text boxes; and an Exit button. Write code in the Form_Load event handler that allows the user to enter the name of the file. If the file does not exist, a new one will be created. If the file already exists, the input data will be appended to the file. ******** Make sure to test your project by entering a new text file name, and then to confirm you are appending data to…arrow_forward
- Files Class Activity Write a program to write your first name (hard coded) to the screen and possibly to a file whose name is passed into the program from the command line. It can be written in upper or lower case or mixed case as the default. Usage: writer [-f filename] If the -f option is included with a filename, then create a file with that name or overwrite a previously existing file and write your name in on the first line. If the -f option is not included, then only write your name to the screen followed by a newline. Use a copy of the original getopt to parse the command line. Be sure to test whether a file open succeeds or not and close any file you open when done.arrow_forwardCoding Problem: GetGrade.py 1 #Write a function called get_grade that will read a 2 #given .en1301 file and return the student's grade. 3 #To do this, we would recommend you first pass the 4 #filename to your previously-written reader() function, 5 #then use the list that it returns to do your 6 #calculations. You may assume the file is well-formed. 7 # 8 #A student's grade should be 100 times the sum of each 9 #individual assignment's grade divided by its total, 10 #multiplied by its weight. So, if the .cs1301 just had 11 #these two lines: 12 # 13 #1 exam 1 80 100 0.6 14 # 2 exam 2 30 50 0.4 15 # 16 #Then the result would be 72: 17 # (Advanced) (External resourc 18 (80/100) 0.6+ (30/50) 0.4-0.72 100 - 72 19 20 21 write your function here! 22 23 24 25 #Below are some lines of code that will test your function. 26 #You can change the value of the variable(s) to test your 27 #function with different inputs. 1234 28 # 29 #If your function works correctly, this will originally 30 #print:…arrow_forwardFunction___________ repositions the file position pointer to the beginning of the filearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License