C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 8.3, Problem 3E
Program Plan Intro
- filename, ch,offset,and last variables are used in the program.
- fail (), seekg (), tellg (),andget () functions are used in the program.
Program Description: The main purpose of the program is to modify the program 8.7 to display an error message when the seekg ()function refers a position beyond the end of the file.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(IN PYTHON)
Problem 1
Write a function word_count() that performs the following actions:
Opens a file called “novel.txt”.
You can assume that the file exists and is located in the same directory as your code file.
Reads in the contents of the file, and stores it in a variable called text.
Uses the split() function to obtain a list containing all of the individual words in text.
For details on how to use split(), you can consult this site: https://www.w3schools.com/python/ref_string_split.asp
For this question, assume that all words will be separated by spaces.
Returns the number of words in the lis
(USING PYTHON)
create a function create employee_objects that takes a list of data as input and
returns back a list with each element as an object that belongs to class Employee
def create employee_objects (data):
#start of code
# end of code
employees_list = create employee_objects (employees_data)
Expected output:
29
(Order of Exception Handlers) Write a program illustrating that the order of exception handlers is important. The first matching handler is the one that executes. Attempt to compile and runyour program two different ways to show that two different handlers execute with two different effects.
Chapter 8 Solutions
C++ for Engineers and Scientists
Ch. 8.1 - Prob. 1ECh. 8.1 - (Practice) a. Write a set of two statements...Ch. 8.1 - Prob. 3ECh. 8.1 - Prob. 4ECh. 8.1 - Prob. 5ECh. 8.1 - Prob. 8ECh. 8.1 - Prob. 9ECh. 8.1 - Prob. 10ECh. 8.2 - Prob. 1ECh. 8.2 - (Practice and modify) a. Enter and run Program...
Ch. 8.2 - (Practice and modify) a. Write a C++ program that...Ch. 8.2 - (Practice) Determine the OS command or procedure...Ch. 8.2 - Prob. 5ECh. 8.2 - (Data processing) a. Write a C++ program that...Ch. 8.2 - Prob. 7ECh. 8.2 - Prob. 8ECh. 8.2 - Prob. 9ECh. 8.3 - Prob. 1ECh. 8.3 - Prob. 2ECh. 8.3 - Prob. 3ECh. 8.3 - Prob. 4ECh. 8.3 - Prob. 5ECh. 8.3 - Prob. 6ECh. 8.4 - Prob. 1ECh. 8.4 - Prob. 2ECh. 8.4 - Prob. 3ECh. 8.4 - Prob. 4ECh. 8.5 - (Practice) Write a C++ program to create the...Ch. 8.5 - Prob. 2ECh. 8.5 - Prob. 3ECh. 8.5 - Prob. 4ECh. 8.5 - Prob. 5ECh. 8 - Prob. 1PPCh. 8 - (Data processing) a. Store the following data in a...Ch. 8 - (Data processing) Write a C++ program that allows...Ch. 8 - (Data processing) Write a C++ program that permits...Ch. 8 - (Data processing) Write a C++ program that reads...Ch. 8 - (Data processing) Write a C++ program that reads...Ch. 8 - Prob. 7PPCh. 8 - (Data processing) A bank’s customer records are to...Ch. 8 - (Inventory) Create an ASCII file with the...
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
- (C Program - this is not graded)arrow_forward(USING PYTHON) create a function create employee_objects that takes a list of data as input and returns back a list with each element as an object that belongs to class Employee def create employee_objects (data): # start of code # end of code employees_list = create_employee_objects (employees_data) Expected output: 29|arrow_forward(C Program)arrow_forward
- (C Language) Given a set of text files containing synonyms for different words, complete the main program to output the synonyms for a specific word. Each text file contains synonyms for the word specified in the file’s name, and the synonyms within the file are grouped according to the synonyms' first letters, separated by an '*'. The program reads a word and a letter from the user and opens the text file associated with the input word. The program then stores the contents of the text file into a two-dimensional array of char* predefined in the program. Finally the program searches the array and outputs all the synonyms that begin with the input letter, one synonym per line, or a message if no synonyms that begin with the input letter are found.arrow_forward(JAVA) AVOID USING BREAKS, CATCH, AND CASE!!!! Texting Translator For this assignment, we are going to work with adding and removing data from arrays, linear search, and File I/O. This program will act as a texting to English converter This program will read a file containing a list of abbreviations used in texting and another file with their English translations. The abbreviations and translations need to be stored in two separate but parallel arrays (Links to an external site.). Open up two new text files inside of Eclipse: Name these text files abbreviations.txt and translations.txt Copy and paste the following list of names into your abbreviations.txt file: 4cuikrkl8l8rlmkm8nvmrsmhuurwu Copy and paste the following list of translations into your translations.txt file: forsee youI know right?okaylatelaterlet me knowmatenever mindareshaking my headyouyou arewhat's up? Starter Code /** * @author * @author * CIS 36B */ import java.util.Scanner; import java.io.File; import…arrow_forward(Data Structures) Using file handlingarrow_forward
- (FRP7) Write a function that reads data from a file. The file has already been opened and verified. The data should be saved in the array of type ship. The size of the array is passed in the int parameter and the number of records read is return in the last parameter, by reference. The file should be read until end of file has been reached or the array is full. struct ship{ string shipCaptain; string shipName; }; The function prototype isvoid readFile( ifstream&, ship[ ], int, int& ); ifstream - The already open file ship[ ] - array of structs where the data from the file will be stored. int - the size of the array. int& - the number of records read from the file. This value is set by the function before returning return- the number of records read from the file, returned by the function. The amount of data in the file is unknown but there is no bad data. The file format is the shipsName followed by the shipsCaptiain . Example: MillenniumFalcon HansSoloarrow_forward(python) prov_vac_status() takes a 2-D list (similar to the database) and an integer representing the province ID. This function returns three values; (i) the total number of unvaccinated patients, (i) the total number of partially vaccinated patients, and (i) the total number of fully vaccinated patients hospitalized in this province during the entire period. Note that these numbers include both the icu and the non-icu patients. >>> res1, res2, res3 = prov_vac_status(database, 12) >>> print(f"{res1}, {res2}, {res3}") >>> 194, 14, 118 >>> print(prov_vac_status(database, 35)) >>> (402, 28, 202) >>> print(prov_vac_status(database, 81)) >>> (0, 0, 0)arrow_forward(python) 8. Write the code that would call a function. Call the bSort function and pass in the variable data. Store the results of the function in a variable called sortedData.arrow_forward
- (JS)Write a function named "tweets" that takes a string as a parameter. If a message can hold at most 280 characters, calculate the smallest number of messages needed to hold all of the text in the input. The function should return the number it calculated.arrow_forward(python) 13. Is the statement true or false? Binary search is used to compare each element of a list when searching for a specific value.arrow_forward(C++) PLEASE INCLUDE COMMENTS AND OUTPUT SCREEN Write a program that will do the following: In main, declare an array of size 20 and name it "randomArray." Use the function in step 2 to fill the array. Use the function in step 3 to print the array. Create a function that generates 20 random integers with a range of 1 to 10 and places them into an array. Re-cycle the functions from Lab 10 where appropriate. Make this a function. There will be two arguments in the parameter list of this function: an array and the size of the array. Within the function and the function prototype name the array: intArray. Within the function and the function prototype name the size of the array: size. The data type of the function will be void since the array will be sent back through the parameter list. Bring in the function that generates and returns a random number that you created from the previous module. Call that function from this within the loop that adds random numbers to the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Computer Fundamentals - Basics for Beginners; Author: Geek's Lesson;https://www.youtube.com/watch?v=eEo_aacpwCw;License: Standard YouTube License, CC-BY