Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 13.7, Problem 13.33CP
Describe the mode that each of the following statements causes a file to be opened in.
file.open("info.dat", ios::in | ios::out);
file.open("info.dat", ios::in | ios::app);
file.open("info.dat", ios::in | ios::out | ios::ate);
file.open("info.dat", ios::in | ios::out | ios::binary);
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Describe the mode that each of the following statements causes a file to be opened in.
file.open("info.dat", ios::in | ios::out);file.open("info.dat", ios::in | ios::app);file.open("info.dat", ios::in | ios::out | ios::ate);file.open("info.dat", ios::in | ios::out | ios::binary);
2. File handling is an important part of any application. Assume that, you are asked to
build an application to find the harmonic mean in a file. Assume that you have to read
the file of "Filel.txt" and print the harmonic mean of each row to an output file
"File2.txt". All of the data in the "File1.txt" is comma separated. In file1.txt you are
given the name of the data set in first place, then you are given the data list. All of them
are comma separated. Your task is to compute the harmonic mean from the given file
| for each dataset. The file may contain more than 1000 rows. Write your code by
following the requirements.
File2.txt
harmonic mean of Datal is 3.50
harmonic mean of Data2 is 3.43
harmonic mean of Data3 is 3.50
File1.txt
Data1, 3, 4, 4, 3, 3.7, 4, 3.3, 1
Data2, 3, 4, 3.7, 3, 3.7, 4, 3, 1
Data3, 3, 4, 4, 3, 3.7, 4, 3, 2
Data4, 3, 4, 4, 3, 3.7, 4, 3.3, 2
Design a JAVA application that can perform the task with the given scenario.
harmonic mean of Data4 is 3.49
Q1: Write a Python program that prompt user to enter at least five entries: 1. Each entry requires two entities: Name (first, last) and Final Score (between 0 and 100) 2. saves the values in a text file 3. calculates the average for Final Score for all the entries written into the file 4. reads that text file and displays its contents on the command prompt including the score average.
Write a Python program that prompts the user to search for a string( first and last name) from the file created in Q1. The program displays the name and the final score for that entry if that name was in the file.
Chapter 13 Solutions
Starting Out with C++: Early Objects (9th 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
Why is it useful for a programmer to have some background in language design, even though he or she may never a...
Concepts Of Programming Languages
T F: If the CInt function cannot convert its argument, it causes a runtime error.
Starting Out With Visual Basic (8th Edition)
Finish the program that takes a word as a command-line argument and looks up the word to see whether it is in t...
Programming in C
Suppose the class SportsCar is a derived class of a class Automobile. Suppose also that the class Automobile ha...
Problem Solving with C++ (9th Edition)
Write code that displays the contents of the int variable i in binary, hexadecimal, and octal.
Starting Out with Java: Early Objects (6th 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
- A student wants to write into a file called myfile, without deleting its existing content. Which one of the following functions should he or she use? f = open('myfile', 'r') f = open('myfile', 'w+b') f = open('myfile', '+') f = open('myfile', 'a')arrow_forwardUsing Java, Write an interactive console application for an employee management service. The user can enter the following options for the apps 1-List all employees, sorted by Name. 2-Hire a new employee (add to list) 3-show the lowest salary and highest salary and average of the salaries 0-exit - At the beginning of the application, data will be read from a text file. - And at the end of it when user chooses 0, data will be saved to the same file. - The date format needs to be YYYY-MM-DD and The fields needs to be separated by semicolon(;) Example of data in the text file : Alice P.;2012-09-22;Shoes;40 Emma W.;2016-07-07;Furniture;30 Eva;2021-08-08;Pizza;50 EmployeeSchedule class has the following attributes private String name; private String department; private Date dateHired; private double hourSalary; name : between 2-50 characters and not permitted to have ;^?@!~* department : between 2-50 characters and not permitted to have ;^?@!~* dateHired : between 1900 and 2100 salary :…arrow_forwardDescribe the mode that each of the following statements causes a file to beopened in.fi l e .open("in fo .dat ", io s: :infile.open("info.dat", io s: :infile.open("info.dat", io s: :infile.open("info.dat", io s: :inios: :out);ios::app);ios: :out I ios: :a te );ios::out I ios::binary);arrow_forward
- Write the program FileComparison that compares two files. Two files have been provided for you, Quote.txt and Quote.docx, both containing movie quotes and are located in the /root/sandbox/ directory Note: you will not be able to see the Quote.docx file. Next write the file comparison application that displays the sizes of the two files as well as the ratio of their sizes to each other. To discover a file’s size, you can create a System.IO.FileInfo object using statements such as the following, where FILE_NAME is a string that contains the name of the file, and size has been declared as an integer: FileInfo fileInfo = new FileInfo(FILE_NAME); size = fileInfo.Length; Your program's output should look like the following: The size of the Word file is FILE_SIZE and the size of the Notepad file is FILE_SIZE The Notepad file is x% of the size of the Word file using System; using static System.Console; using System.IO; class FileComparison { static void Main() { // Getting…arrow_forward1. Write a program that opens an output file with the filename my_name.txt, writes your name to the file, then closes the file. 2. Write a program that opens the my_name.txt file that was created by the program in problem 1, reads your name from the file, displays the name on the screen, then closes the file. Write code that does the following: opens an output file with the filename number_list.arrow_forwardWrite a program (in Java or C++), allowing to: • Create a folder "Main" • Create a file in the folder "File1" Add Read, Write permissions to "File1" Write in "File1" ● ● Read the content of "File1" ● Modify the content of "File1" Remove the Write permission of "File1" Try to write again in "File1" ● A screenshot is needed showing the results of the program execution.arrow_forward
- Use python language for a program that modifies and sorts the content of a specific csv file based on the inputted column name. The program should ask Enter filename: Enter column name to be sorted: Additionally, the csv file must be modified and no additional csv files must be created. The application will catch and display an error message "the file does not exist" if the csv file does not exist. *if possibe, do not use pandas*arrow_forwardMusic App 1. practise file I/O and exception handling; 2. practise String processing. Aim: Task: Create a Java application that transcripts a simple song score sheet. The program asks user for filename of a text file that contains a simple song score sheet in this format: Sample song score sheet 1, song1.txt: #simple song with assumed time signature = 4 d1mls202s 1mld2o2 d1rimlfls 301s1f1m1rld4 Lines beginning with a hash #' is a comment line. A song contains one or more lines of musical notes, d, r, m, f, s, l, tand also o meaning "Off" or rest. Each single character note is followed by a single digit integer in [1 – 4], denoting the duration of the note in number of beats. After transcription, the program outputs the melody on the screen as well as to another text file: Melody output 1, on screen AND in melody_song1.txt: #simple song with assumed time signature Do Me So- Off- So Me Do Re Me Fa| So-- Off = 4 Do- Off- | So Fa Me Re Do--- | The default time signature is 4 beats per…arrow_forwardExamine the following three functions that take as argument a file name and return the extension of that file. For instance, if the file name is 'myfile.tar.gz' the returned value of the function should be 'gz'. If the file name has no extention, i.e. when the file name is just 'myfile', the function should return an empty string. def get_extension1(filename): return(filename.split(".")[-1]) def get_extension2(filename): import os.path return(os.path.splitext(filename)[1]) def get_extension3(filename): return filename[filename.rfind('.'):][1:] Which of the these functions are doing exactly what they are supposed to do according to the description above? get_extension3 only get_extension2 only None of them. get_extension1 onlyarrow_forward
- Write the code in python Create an application that can create, display, search and maintain the book information for a bookstore. Requirements: 1) you need to use functions to write code for each menu item. 2) Information of books will be saved in a file, e.g,, books.txt. 3)User can add any number of books to the booklist. There can be 5 books or 500 books. In order for your program to handle it without any changes in the code, you cannot hardcode the number of books in your program.arrow_forwardIN PYTHON LANGUAGEarrow_forwardPythonarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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