Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13.1, Problem 13.11CP
Show how to use the constructor of the fstream class to open a file for input without having to call the open function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
At the end of this and other textbooks, there usually is an index that lists the pages where a certain word appears. In this problem, you will create an index for a text but, instead of page number, you will use the line numbers.
You will implement function index() that takes as input the name of a text file and a list of words. For every word in the list, your function will find the lines in the text file where the word occurs and print the corresponding line numbers (where the numbering starts at 1). You should open and read the file only once
Create the python function as part of a python program. The data required for the function should be created in the python program and passed to the function.
its an exercise pyrthon problem 6.27
I opened a CSV file in C++ and the headings of the file are Name, Class, Subject, Standing (in same order).
I want to output the file on the console in ascending order of Subject (later I will be performing insert sort). how do I make it in ascending order of Subject which is third column. please add code.
Write a program that reads words from a file (filename given as a string parameter) and prints the occurance of each word(case insensitive). And print the words in alphabetical order.
For example, if the file contains text
Love is free free is love
then the function should print
free:2 is:2 love:2
def count_word(filename):
# YOUR CODE HERE raise NotImplementedError()
Chapter 13 Solutions
Starting Out With C++: Early Objects (10th Edition)
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
?.1 Define the different reference meridians that can be used for the direction ofa line.
Elementary Surveying: An Introduction To Geomatics (15th Edition)
What is denormalization?
Database Concepts (8th Edition)
What are the advantages in implementing a language with a pure interpreter?
Concepts Of Programming Languages
True or False: When a class contains an abstract method, the class cannot be instantiated.
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Determine the moment of each of the three forces about point A.
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
The overhang beam is subjected to the uniform distributed load having an intensity of w=50 kN/m. Determine the ...
Mechanics of Materials (10th 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
- This needs to be written in C programming. It is a practice program and it is not graded. So if you could help that would be great. I just need someone to show me what the program looks like.arrow_forwardpls code in pythonplagiarism: This Boolean function takes two filenames. If any line occurs in both files, return True.If not, return False. I suggest using nested loops. With nested loops, we call the loop that is in thebody of the other loop, the "inner loop". The loop that contains the inner loop is the "outer loop". Openthe second file inside the outer loop:for line1 in file1:file2 = open(fname2)for line2 in file2:Python only lets you read the file once per open, so you need this order of instructions. Make sure yourreturn False is outside of both loops. Otherwise, you will only compare the first two lines of thefiles. Make sure you close the file that gets read repeatedly after the inner loop but still inside the outerloop.Here is some (more complete) pseudocode to get you started:open file 1for line1 in file 1open file 2for line2 in file 2:if line1 == line2:return Trueclose file 2return Falsearrow_forwardWrite a program in C++ that creates a file and writes data into that file column wise. The problem is that there is some data that I want to keep there permantely and I do not want to replace it every time. For example this format: TIME DAY MONTH YEAR 01:25 07 JUNE 2008 14:00 30 MARCH 2019 I have (TIME/ DAY/ MOTH/ YEAR) and I want to write that first and that any data that I add later is written under that and so on. If I want to add the row (05:05/ 10/ July/ 2000) following the pattern. Write code that checks if the file has data and write that data under the lines you already have.arrow_forward
- Please help with this exercise I found on the internet. I want to know the solution, also with explaining( can use # in the coding),thanksarrow_forwardplease use spyderarrow_forwardImplement a function wordCount, which reads a text file, and returns thenumber of words in the file. You can assume the file only contains thealphabet characters and the space character. However there may be morethan one space character between two words, so “abc abc” and “abc abc”,for example, are both two words. int wordCount ( const char * filename ) {}arrow_forward
- Matlab Exercise: Create a wav file of your own voice by reading and recording the letters A, B, C and D. (You may use the application 'audacity' for this purpose Read the file from matlab. Find out the size of the matrix. Plot the wave file. Find out the length of recording from the plot. Play the sound file from matlab Work on the matrix so that the letters B and D will he audible on one track only while playing Work agaitn on the matrix so that the letters B and D are elitminated cumpletely from the wave file. In MATLABarrow_forwardC++ A teacher is requiring her students to line up in alphabetical order, according to their first names..For example, in one class Chapel, Christine would be at the front and Uhura, Nyota would be last. The program will get the names from a file. The names should be read in until there is no more data to read. The program should prompt the user for the file name and read the data from the file. A suitable file of names (List of Random Names) is provided on Moodle. Note that these names might include spaces; handle your input accordingly. The expected output is two names; do not show the entire file (or you will regret that code when you do the associated programming quiz that processes thousands of names). Do not use arrays or sorting for this problem.arrow_forwardWrite a function called countWord(). It takes 2 parameters: The name of a text file(e.g. gettysburg.txt) and a word to be searched within that file. Your code should returnthe number of times the given word appears in the file.>>> countWord('gettysburg.txt', 'people')3arrow_forward
- Do not read directly from the example files, as the automated testing system expects you to read from the standard input. Instead, process the lines as follows: 3 - Geography Grades 3 Make a copy of your program for the problem Geography Grades 2 and change the code in such a way that your program can process multiple groups. These groups are on the input separated by ’=\n’. Every group starts with a first line that contains the name of the group and the lines after contain the information about the students in the same way as is specified for the problem Geography Grades 1. With the input 1bErik Eriksen__________4.3 4.9 6.7Frans Franssen________5.8 6.9 8.0=2bAnne Adema____________6.5 5.5 4.5Bea de Bruin__________6.7 7.2 7.7Chris Cohen___________6.8 7.8 7.3Dirk Dirksen__________1.0 5.0 7.7 The output should be: Report for group 1bErik Eriksen has a final grade of 6.0Frans Franssen has a final grade of 7.0End of reportReport for group 2bAnne Adema has a final grade of 6.0Bea de Bruin…arrow_forwardWrite a function-based C++ program that reads an integer array from a file (“input.txt”) and finds all integers which start and end with the same digit. Write these integers into an output file (“output.txt”). You may assume the length of each integer to be a minimum of 2 digits. Example: Input File 12 131 54 7541 9849 6456 Output File 131 9849 6456arrow_forwardi have write a heml file without show the header section ,i want to know whyarrow_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 Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
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