int main() { fstream f("Fpp.bin", ios:: out ios: :binary); double y, q %3; // Part I int ix = 1; for (; ix = 6; ix++) { y = 2*ix - 1; f.write ((char *) &y, sizeof (y)); = y; f.write ( (char ) &q, sizeof (q)); f.close ();

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
[A] 6 a. [B] 1025 [A]5 b.[B] 2125 [A] 6 C. [B] 925 [A]5 d. [B] 1536 [A] 5 e. [B] 1036
Consider the program below and assume all headers are included. Find [A] the number of lines read from the file and [B] the output to the screen.
2
int main ()
3.
fstream f("Fpp.bin", ios:: out | ios: :binary);
double y, q = 03;
4.
6.
// Part I
8.
int ix = 1;
6.
for (; ix = 6; ix++)
10
y = 2*ix -1;
f.write ((char
11
* ) &y, sizeof (y) ):
13
q = y;
14
15
f.write ( (char *) &q, sizeof(q));
f.close ();
16
17
18
1 Dart
TT
7:50 PM
52°F
12/12/2021
PrtScr
Insert
Home
End
Del
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
111 1111
Transcribed Image Text:Consider the program below and assume all headers are included. Find [A] the number of lines read from the file and [B] the output to the screen. 2 int main () 3. fstream f("Fpp.bin", ios:: out | ios: :binary); double y, q = 03; 4. 6. // Part I 8. int ix = 1; 6. for (; ix = 6; ix++) 10 y = 2*ix -1; f.write ((char 11 * ) &y, sizeof (y) ): 13 q = y; 14 15 f.write ( (char *) &q, sizeof(q)); f.close (); 16 17 18 1 Dart TT 7:50 PM 52°F 12/12/2021 PrtScr Insert Home End Del F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 111 1111
// Part II
fstream ff ("Fpp.bin", ios::in | ios: :binary):
int qq = 0;
for (int jx=1; jx < ix; jx++)
19
20
21
22
ff.read((char *)&y, sizeof (y));
if( jx % 2 = 1)
23
24
%3D
25
qq += y;
26
27
28
cout << qq << q < endl;
ff.close (;
29
30
return 0;
31
32
//
52°F
(3)
7 0 0 012
HHH NNN N22 222N333
Transcribed Image Text:// Part II fstream ff ("Fpp.bin", ios::in | ios: :binary): int qq = 0; for (int jx=1; jx < ix; jx++) 19 20 21 22 ff.read((char *)&y, sizeof (y)); if( jx % 2 = 1) 23 24 %3D 25 qq += y; 26 27 28 cout << qq << q < endl; ff.close (; 29 30 return 0; 31 32 // 52°F (3) 7 0 0 012 HHH NNN N22 222N333
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education