C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Question
Chapter 8.3, Problem 1E
(a)
Program Plan Intro
To create a file named test.dat.This file contains the data of the test.dat file used in the
(b)
Program Plan Intro
Program Plan:
- 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 enter and run the program 8.7 from the book named C++ for Engineers and Scientists, 4th Edition.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(python)
Is the statement true or false?
Use the open function to open a file for input and/or output.
(python)
Write the lines of code that will open a file (Test.txt), read and output each line in that file.
(C ONLY) The program expects the name of an input
file and an output file to be given by the user. If the
user does not input any names, default file names
should be used, such as input.txt and output.txt.
The input files have lines which look like this: 3
Tester College; 1909 33001 The first number
represents the rank; it is followed by the school
name, year founded, and approximate number of
students. Read the list of colleges into an array of
structures. You may assume that the maximum size
of a college name string is 64. The program should
use either the insertion sort algorithm or the
selection sort algorithm to sort the array in
descending order by rank. Display any k consecutive
schools requested by the user. For instance, if the
user enters 12, the program displays the first 2
schools in a readable format of your choice. If the
user enters 15, the program displays the first five
schools, if the user enters 2 7, display 7 schools
beginning with the one at index 1 (2 - 1), and so…
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
Similar questions
- (Java) Write data to a text file file with class Formatter. Ask the user to enter a n account number, first name, last name, and account balance. Make sure to provide the user with an end-of-file indicator to end input.arrow_forward(Write a C++ program) This homework is from our textbook page 459 # 16. The Dodgers recently won the World Series vs the Tampa Bay Rays. Attached are two files: Teams.txt - This file contains a list of serveral Major League baseball teams in alphabetical order. Each team is listed in the file has won the World Series at least once. WorldSeries Winners.txt - This file contains a chronological list of the World Series' winning teams from 1903-2020. (The first line of the file is the name of the team that won in 1903, and the last line is the name of the team that won in 2020. Note the World Series was not played in 1904 or 1994.) Write a program that displays the contents of the Teams.txt file on the screen and prompts the user to enter the name of one of the teams. The program should then display the number of times that team has won the World Series in the time period from 1903 to 2020. In the program, 2 arrays are needed: TeamList array and Winners array. TeamList array will…arrow_forward(Q. Write a program that will read a file from the user and writes its content in another file such that each line contains only 8 words. Coding language python Don't use pointers and arrays keep the program as simple as possible (beginner's level) Paste the screenshots of full program with output) inputfile = input('Enter filename to read: ') outputfile = input('Enter filename to write: ') f = open(inputfile,'r') f1 = open(outputfile,'w') for lines in f: f1.writelines(lines) f.close() f1.close() ***write comments on each line of the above written program and make changes in it with accordance to question if anything is wrong and also check if the underlined part of question is solved in program or notarrow_forward
- (python) Write a function sum_file(f) that takes a filename f. Each line in f contains a single number. You should write to the last line in the file the sum of all the numbers written in the file.arrow_forward(python) Write a few lines of code that would open a file named "Test.txt", read in all of the data and print out that data too.arrow_forward[no. 19] When would you use a while loop? a. when you want some code to continue running as long as some condition is true b. when you want to run code in one file while code in another file is also running c. when you want to minimize the use of strings in your code d. when you need to run two or more chunks of code at once within the same filearrow_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(Intro to Python) Assume there is a file called numbers.txt (in the current working directory) with unknown number of integer values on each line. Write a program to read the numbers from the file, add them and then display the total. Use try-except clause to handle errors associated with working with files. This should work for any number of values in the file. If the file does not exist, it should not throw a runtime error. Sample output is, Read 6 numbers They are 5 7 8 3 100 14 Their total is 137arrow_forward(python) 27. Use the following option to open a file with read only access: a. 'a' b. 'r' c. 'r+' d. 'w'arrow_forward
- (python) Write a loop that runs 10 times and inputs data from the user. That data is added to a running total. After the loop is finished, output the total.arrow_forward(c) Write a Haskell program that: • Reads two files, called "input1.txt" and "input2.txt". • Interleaves the lines of the two files. • Writes the result to a file called "output12.txt" . You may make use of any functions in the Reference (pp5-7).arrow_forward(C++ Language) Create a function that writes to a file named Inventy.txt the information of 8 items. Ask the user for the item's name, the item's quantity in storage, and the item's price and write it to the file. Create a function that reads the file and items' quantity and price to two different arrays. Create a function that computes the subtotal of each item. Implement all functions inside the main program and the computed value should be displayed with the item's name.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