4.51 Generate an index for a book. The input file consists of a set of index entries. Each line consists of the string IX:, followed by an index entry name enclosed in braces, followed by a page number that is enclosed in braces. Each ! in an index entry name represents a sublevel. A |( represents the start of a range, and a |) represents the end of the range. Occasionally, this range will be the same page. In that case, output only a single page number. Otherwise, do not collapse or expand ranges on your own. As an example, Figure 4.79 shows sample input and Figure 4.80 shows the corresponding output.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

C++ 

 

Must answer properly also do attach ouput screenshot and code else downvote

Generate an index for a book. The input file consists of a set of index entries. Each
line consists of the string IX:, followed by an index entry name enclosed in braces,
followed by a page number that is enclosed in braces. Each ! in an index entry
name represents a sublevel. A |( represents the start of a range, and a |) represents
the end of the range. Occasionally, this range will be the same page. In that case,
output only a single page number. Otherwise, do not collapse or expand ranges on
your own. As an example, Figure 4.79 shows sample input and Figure 4.80 shows
the corresponding output.
4.51
References
189
IX: {Series | (}
IX: {Series!geometric |(} {4}
IX: {Euler's constant}
{2}
{4}
IX: {Series!geometric|)} {4}
IX: {Series!arithmetic|(} {4}
IX: {Series!arithmetic|)} {5}
IX: {Series!harmonic| (}
IX: {Euler's constant}
IX: {Series!harmonic|)}
IX: (Series |)}
{5}
{5}
{5}
{5}
Figure 4.79 Sample input for Exercise 4.51
Euler's constant: 4, 5
Series: 2-5
arithmetic: 4-5
geometric: 4
harmonic: 5
Figure 4.80 Sample output for Exercise 4.51
Transcribed Image Text:Generate an index for a book. The input file consists of a set of index entries. Each line consists of the string IX:, followed by an index entry name enclosed in braces, followed by a page number that is enclosed in braces. Each ! in an index entry name represents a sublevel. A |( represents the start of a range, and a |) represents the end of the range. Occasionally, this range will be the same page. In that case, output only a single page number. Otherwise, do not collapse or expand ranges on your own. As an example, Figure 4.79 shows sample input and Figure 4.80 shows the corresponding output. 4.51 References 189 IX: {Series | (} IX: {Series!geometric |(} {4} IX: {Euler's constant} {2} {4} IX: {Series!geometric|)} {4} IX: {Series!arithmetic|(} {4} IX: {Series!arithmetic|)} {5} IX: {Series!harmonic| (} IX: {Euler's constant} IX: {Series!harmonic|)} IX: (Series |)} {5} {5} {5} {5} Figure 4.79 Sample input for Exercise 4.51 Euler's constant: 4, 5 Series: 2-5 arithmetic: 4-5 geometric: 4 harmonic: 5 Figure 4.80 Sample output for Exercise 4.51
Expert Solution
steps

Step by step

Solved in 5 steps with 9 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY