Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 12, Problem 30RQE
Program Description Answer
A “type cast” operator is important to pass other data types instead of “pointer to a char” as the argument for “read” and “write” member functions.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
In C, in order to do operations to the data being referenced by a pointer you would need to use the (*) operator, which is called ______________
operator.
You can dereference a smart pointer with the * operator.
True
False
C++
Chapter 12 Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Ch. 12.1 - Which file access flag would you use if you want...Ch. 12.1 - Prob. 12.2CPCh. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Assuming diskInfo is an fstream object, write a...Ch. 12.1 - Write a statement that defines an fstream object...Ch. 12.5 - Assume the file input.txt contains the following...Ch. 12.5 - Describe the difference between reading a file...Ch. 12.5 - What will be stored in the file out.txt after the...Ch. 12.10 - Describe the difference between the seekg and the...
Ch. 12.10 - Describe the difference between the tellg and the...Ch. 12.10 - Describe the meaning of the following file access...Ch. 12.10 - What is the number of the first byte in a file?Ch. 12.10 - Briefly describe what each of the following...Ch. 12.10 - Describe the mode that each of the following...Ch. 12 - What capability does the fstream data type provide...Ch. 12 - Which file access flag do you use to open a file...Ch. 12 - Assume the file data.txt already exists, and the...Ch. 12 - How do you combine multiple file access flags when...Ch. 12 - Should file stream objects be passed to functions...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - Under what circumstances is a file stream objects...Ch. 12 - How do you read the contents of a text file that...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - What arguments do you pass to a file stream...Ch. 12 - Prob. 12RQECh. 12 - Prob. 13RQECh. 12 - How do you get the byte number of a files current...Ch. 12 - If a program has read to the end of a file, what...Ch. 12 - How do you determine the number of bytes that a...Ch. 12 - How do you rewind a sequential-access file?Ch. 12 - The _____ file stream data type is for output...Ch. 12 - If a file fails to open, the file stream object...Ch. 12 - The same formatting techniques used with...Ch. 12 - The _____ function reads a line of text from a...Ch. 12 - The ____________ member function reads a single...Ch. 12 - The ________member function writes a single...Ch. 12 - Prob. 24RQECh. 12 - __________ files contain data formatted as...Ch. 12 - Prob. 26RQECh. 12 - Prob. 27RQECh. 12 - The ___________ member function writes raw binary...Ch. 12 - The __________ member function reads raw binary...Ch. 12 - Prob. 30RQECh. 12 - In ___________ file access, the contents of the...Ch. 12 - In __________ file access, the contents of a file...Ch. 12 - The _____________ member function moves a files...Ch. 12 - The ___________ member function moves a files...Ch. 12 - The __________ member function returns a files...Ch. 12 - The ___________ member function returns a files...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The __________ mode flag causes an offset to be...Ch. 12 - The ________ mode flag causes an offset to be...Ch. 12 - A negative offset causes the files read or write...Ch. 12 - Write a statement that defines a file stream...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write two statements that use a file stream object...Ch. 12 - Write a program segment that defines a file stream...Ch. 12 - Write code that opens the file data.txt for both...Ch. 12 - Write code that determines the number of bytes...Ch. 12 - The infoFile file stream object is used to...Ch. 12 - T F Different operating systems have different...Ch. 12 - T F fstream objects are only capable of performing...Ch. 12 - T F ofstream objects, by default, delete the...Ch. 12 - T F ifstream objects, by default, create a file if...Ch. 12 - T F Several file access flags may be joined by...Ch. 12 - T F A file may be opened in the definition of the...Ch. 12 - T F If a file is opened in the definition of the...Ch. 12 - T F A file stream objects fail member function may...Ch. 12 - T F The same output formatting techniques used...Ch. 12 - T F The operator expects data to be delimited by...Ch. 12 - T F The getline member function can be used to...Ch. 12 - T F It is not possible to have more than one file...Ch. 12 - T F Binary files contain unformatted data, not...Ch. 12 - T F Binary is the default mode in which files are...Ch. 12 - T F The tellp member function tells a file stream...Ch. 12 - T F It is possible to open a file for both input...Ch. 12 - fstream file(ios::in | ios::out);...Ch. 12 - ofstream file; file.open (info.dat, ios::tin); if...Ch. 12 - fstream file("info.dat"); if (!file) { cout ...Ch. 12 - fstream dataFile("info.dat", ios:in | ios:binary);...Ch. 12 - Prob. 69RQECh. 12 - fstream dataFi1e("info.dat", ios:in); char...Ch. 12 - Prob. 71RQECh. 12 - fstream inFile("info.dat", ios:in); int x;...Ch. 12 - File Head Program Write a program that asks the...Ch. 12 - File Display Program Write a program that asks the...Ch. 12 - Punch Line Write a program that reads and prints a...Ch. 12 - Tail Program Write a program that asks the user...Ch. 12 - Line Numbers (This assignment could be done as a...Ch. 12 - String Search Write a program that asks the user...Ch. 12 - Sentence Filter Write a program that asks the user...Ch. 12 - Array/File Functions Write a function named...Ch. 12 - File Encryption Filter File encryption is the...Ch. 12 - File Decryption Filter Write a program that...Ch. 12 - Prob. 11PCCh. 12 - Prob. 12PCCh. 12 - Inventory Program Write a program that uses a...Ch. 12 - Inventory Screen Report Write a program that reads...Ch. 12 - Average Number of Words If you have downloaded...Ch. 12 - Customer Accounts This program should be designed...
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
- # Question 4def costume_rating(costume_color, bling_value): """ Returns a function that calculates the number of candies to return based on the costume color, bling value, and phrase length. Args: costume_color (str): The color of your costume. Must be one of 'blue', 'red', 'green', 'yellow', 'purple', or 'orange'. bling_value (int): Represents how shiny your costume is. Must be a positive integer. Returns: A function that takes in one parameter: phrase (str): The phrase said by the trick-or-treater. >>> costume_rater = costume_rating('blue', 5) >>> costume_rater('19 Character Phrase') 85 >>> costume_rater('e') 0 >>> costume_rater('seven c') 1 >>> costume_rater = costume_rating('orange', 8) >>> costume_rater('hello i want candy') 14 >>> costume_rater = costume_rating('yellow', 5) >>> costume_rater('please give me…arrow_forwardCode is here- def validate_name(passed_name): '''This function is used to validate the first and last name''' valid = False valid_chars = ['"', '\''] for character in passed_name: if character.isalpha() or character.isspace() and character in valid_chars: valid = True else: valid = False break return valid def validate_company(passed_model): '''This function is used to test the company name''' bad_chars = ['"'] if passed_model: for character in passed_model: if character in bad_chars: print("Company name is incorrect. Please try again. ") return False return True else: print("Please try again.") return False def validate_address(passed_model): '''This function is used to validate the vehicle model''' bad_chars = [ "!", '"', "@", "$", "%", "^", "$", "*", "_", "=", "+", "<", ">", "?", ";", "[", "]", "{", "}"] if passed_model: for character in passed_model: if character in bad_chars: print("Address is incorrect. Please try again.") return False return True else:…arrow_forward10. Which of the following statements is TRUE about pointer? A. Two pointers can be declared as int * pointer1, pointer2:. В. A function can return a pointer value. Pointer directly references value. D. Pointer is used to pass parameter by value.arrow_forward
- TRUE OR FALSE, C++ When passing an array to a function, you must include & in front of the array name. When passing an array to a function, you must include & in front of the array name. It is possible to have a 2-dimensional array where each row has a different number of columns. The * is called the address of operator.arrow_forwardTri_areaarrow_forwardCorrectFormation Create a program and locally declare in main fname and Iname and completeName. Ask the user for their first and last name. Put the values into fname and Iname. You will create a function that is called as followed. joinNames( fname, Iname, completeName ); You will pass the first name array, the last name array, and the array that will contain the complete name. The function named joinNames should put the first and last names together in completeName. Make sure that the first and last names begin with capital letters, and that ll others are lower case. Display the final combined name. O X Please enter your first name:chuck wagon Please enter your last name:The complete name is Chuck Wagon Process returned e (@x) execution time : 5.192 5 Press any key to continue.arrow_forward
- Create a function called volume The function will calculate the volume of a cube. It will receive 3 integers, length, width and height. It will return the volume as an integer.arrow_forward7.Celsius Temperature Table //write code under void challenge and create function The formula for converting a temperature from Fahrenheit to Celsius is C=59(F−32)C=59(F-32) where F is the Fahrenheit temperature and C is the Celsius temperature. Write a function named celsius that accepts a Fahrenheit temperature as an argument. The function should return the temperature, converted to Celsius. Demonstrate the function by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.\ my code below please adust and use chapter 1- 6 terminology //use only chapter 1-6 terminology!!// must validate input using do while loop examle line 98 - 108// //call functions and follow the challenge instructions//Description: Assignment6 C++ Chapter 6 #include <iostream>#include <string>#include <iomanip>#include <fstream>using namespace std; // Function prototypesint menuOption(); double getSales(string…arrow_forward**C PROGRAMMING LANGUAGE **PLEASE PUT SOME COMMENTS ** DOUBLE CHECK IF IT WORKS Q IN PICTUREarrow_forward
- Task 02: Write a C++ program which computes the difference between two time periods. Program contains one user defined function named difference (). • Create a structure of Time that contains following data members: o Seconds, minutes, hours. Difference() should include the following arguments: • Seconds minutes hours of first time period. Seconds minutes hours of second time period. • Difference between the times as pointer.arrow_forwardAssume that number is an int array and intptr is an int pointer. Which statement correctly assigns the address of the number array to the intptr pointer?• *intptr = &number;• intptr = &number;• intptr = *number;• intptr = number;arrow_forwardA pointer variable cannot be: A Passed to a function as argument. B B Changed within the funcction. C Returned by a function. D Assigned as an integer value. Darrow_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 PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage