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
Textbook Question
Chapter 12, Problem 68RQE
fstream dataFile("info.dat", ios:in | ios:binary);
int x = 5;
dataFile ≪ x;
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
1
2 var a = 6;
3 var b
= 5;
4 var c = 0;
6 function mystery (numl, num2) {
7
var a;
8.
c = numl + num2;
6.
a = numl + num2 + C;
10
num2 - numl;
document.write(c + "" );
document.write(a + "" );
11
12
13 }
14
15 mystery ( 4, 3);
16 document.write(a +
+ b + "");
17 document.write(c +
"" );
18
19
What value for 'c' does line 11 display?
What value for 'a' does line 12 display:
What value for 'a' does line 16 display:
What value for 'b' does line 16 display:
What value for 'c' does line 17 display:
Define the following data structures:
Record
File
Array
String
bit_flag.c
#include <stdio.h>
#include <stdlib.h>
#include "bit_flags.h"
typedef struct bit_flags
{
int size;
int capacity;
int *bit;
} Bit_flags;
BIT_FLAGS bit_flags_init_number_of_bits(int number_of_bits)
{
Bit_flags* pBit_flags;
if(number_of_bits > 0) // The given number is positive
{
pBit_flags = (Bit_flags*)malloc(sizeof(Bit_flags));
if(pBit_flags != NULL)
{
pBit_flags->capacity = sizeof(int);
pBit_flags->size = number_of_bits;
pBit_flags->bit = (int*)malloc(sizeof(int));
if(pBit_flags->bit != NULL)
{
*pBit_flags->bit = 0;
}
else
{
printf("Could not set memory for bit value.\n");
pBit_flags = NULL;
}
}
printf("Bit flags object memory print created!\n\n");
}
else // Given number was 0 or negative
{
printf("Number of bits cannot be negative.\n");
pBit_flags = NULL;
}
return pBit_flags;
}
Status bit_flags_set_flag(BIT_FLAGS hBit_flags, int flag_position)
{
Status stat;
int bit_to_set = flag_position;
int* temp;
Bit_flags* phBit_flags =…
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...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Modify the Product_T table by adding an attribute QtyOnHand that can be used to track the finished goods invent...
Modern Database Management
Each of the following class declarations and/or member function definitions has errors. Find as many as you can...
Starting Out with C++: Early Objects
(De Morgans Laws)In this chapter, we discussed the logical operators **&, Ó� Ó�, and !. De Morgan’s Laws can so...
C How to Program (8th Edition)
The job of the _____ is to fetch instructions, carry out the operations commanded by the instructions, and prod...
Starting Out With Visual Basic (8th Edition)
The decimal number 17 is equal to the binary number 10010 11000 10001 01001
Digital Fundamentals (11th Edition)
What is an infinite loop? Write the code for an infinite loop.
Starting Out with Java: From Control Structures through Data Structures (3rd 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
- prepare a flowchart please # inside data sub subarray[serial, name, amount]; # My data; data = [['01','A',4000],['02','B',8000],['03','C',10000],['04','D',12000],['05','E',16000]] serial = 0 name = 1 amount = 2 #update.... total = 0; for i in data: total = total+i[amount] print(f"The total amount is: {total}")arrow_forward{"postalCodes": [{"adminC ode2":"013", "adminCode1" : "AZ", "adminName2": "Mari copa","lng":- 111.926144, "countryCode" : "US", "postalCode":"8528 1", "adminName1": "Arizona ", "placeName":"Tempe","l at":33.422675}]} Figure 6.0 Code Block Review Figure 6.0. In the REST web service, data can be restored in various formats. Figure 6.0 Code Block represents which format of restoring the data XML O HTML O JavaScript O JSONarrow_forwardThe following program or program segment has errors. Find as many as you can. fstream dataFile("info.dat", ios:out); struct Date{ int month;int day;int year; };Date dt = { 4, 2, 98 }; dataFile.write(&dt, sizeof(int));arrow_forward
- python function that creates and saves data in a file. the saved data represents exam grades. in the function , you will create n random numbers in the range 1-100, where n is the number of students. The function can be called as follows: createFile(filename, n) main function, in which the user inputs the file name and the number of students, then the main calls function createfile. the main should preform validation for n (should be > 0), and the filename(should end with .txt)arrow_forward{wcwR : w e {a, b}* }arrow_forwardWhat is stored in score1, score2, and grade? Integer score1 - 72; int score2-85; Character grade - 'C'; O 72,85, C obj reference, obj reference, obj reference O obj reference, obj reference, C O obj reference, 85, obj referencearrow_forward
- Insert >,< or = as appropriate in the expression 14/15,56/59arrow_forwardfix code and remove errorsarrow_forwardFile read write and string manipulation data1.txt(down below) 4,5-t 2,4-d 20-p7int 2D 2nd 2 1080 &c 10-p7int 10th 11-p7int 12-p7int 16-p7int 18-p7int 1st 2,4,5-t 2,4-d 20-p7int 2D 2nd 30-30 3D 3-D 3M 3rd 48-p7int 4-D 4GL 4H 4th 5-p7int 5-T 5th 6-p7int 6th 7-p7int 7th 8-p7int 8th 9-p7int 9th @ @' @- @&M @&P @. @.@.@. @.B. @.B.@. @.C. @.D. @.D.C. @.F. @.F.@.M. @.G. @.H. @.I. @.I.@. @.I.D. @.L. @.L.P. @.M. @.M.@. @.M.D.G. @.N. @.p. @.r. @.R.C.S. @.U. @.U.C. @.V. @.w. @.W.O.L. @/C @/F j54rs54y54d J54rs54yit54 j54rs54yit54s J54rs54ym@n j54rs54ys j54rs54y's J54rs54yvill54 j54rt J54rubb@@l J54rubb@l J54rus@l54m J54rus@l54mit54 j54rvi@ j54rvin j54rvin@ j54rvin54 J54rvis J54rk J54S J54sh J54sh54r J54smin54 j54sp54r J54sp54rs54n J54ss J54ss@ J54ss@b54ll j54ss@k5454d J54ss@lin J54ss@lyn j54ss@my j54ss@mi54s J54ss@myn J54ss@min54 j54ss@nt J54ss54 J54ss54@n j54ss54d J54ss5454 J54ss54y J54ss54lyn J54ss54lt7n J54ss54n j54ss54s J54ssi J54ssy J54ssic@ J54ssi54 kikkl54 kikkl54d kikkl54s…arrow_forward
- Print Person Information from file In this lab you are asked to complete the function : print_person_from_file(person_name, filename). This function should read in data from the file filename and print the information for person_name if it is found in the file. The file filename contains lines, in comma separated format (with a 'csv' extension) For each line, the items in each field are as follows: Field 1 3 4 Name Place of Birth Date of Birth Children For Children: • a person can have 0, 1 or multiple Children Multiple children are semi-colon separated If a person has no children the field contains 'NA' For example, consider the following lines froma .csv file, where Fletcher_Margaret has 3 children, and Baker_Jill has 0 children (field 4 contains the string 'NA') Fletcher Margaret,Sydney,30-09-1921,Green Bob;Green Nancy;William Tom Baker_Jill, Melbourne,08-09-1973, NA Format for Printing If the person_name is found in the file, the format for printing the person information is as…arrow_forwardview View Help BLUEBEAM ed to edit, it's safer to stay in Protected View. Enable Editing T1 is the internal temperature in °C. Tɔ is the extermal temperature in °C. ASSIGNMENT: Write a C program that will allow the user to enter the inner and outer radii of the pipe, the length of the pipe, and the internal and external temperatures. Once the user enters the input values, the program will compute the pipe s heat conduction for a carbon steel pipe with ak value of 54 Watts/ C/m. Define the k value as a symbolic constant. Note that the k value is in meters, but the user is entering the pipe's dimensions in centimeters (a unit conversion will be required). Your program output will look like the illustration shown below. Use your PC's cursor to determine the horizontal and vertical spacing for the output format. OUTPUT FORMAT: CYLINDRICAL SOLID WALL HEAT CONDUCTION Enter inner radius of pipe in cm Enter outer radius of pipe in cm Enter length of pipe in cm Enter internal temperature in…arrow_forward31 In c# visual studio add a windows form and run stored procedure using parameters. Please write correct code, also write code in c# to connect to MS sql server database called StoreCall Created with Mi Notesarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
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