Write a program that collects from the user(keyboard) the first few lines of Hamlet.  Inputting text lines into the program should use cin.getline( …..) function. The program should contain the following parts:  an  array of char pointers *ptr[15] – there are more char pointers than text lines  declare a temporary char pointer (*tmp)  declare a char Phrase[32] which is used to store temporarily each input line of Hamlet  each new line of text  is stored in Phrase and should be copied onto the heap and its memory location assigned sequentially to ptr[i].  Recall that you must allocate memory on the heap via new memory function.  after collecting all lines of text – print all input text lines (track # of input lines with int LineCnt)  change each uppercase letter to lowercase on the entire text Hamlet  print all text lines containing a punctuation symbol(; , . ?)  print all text lines that contain the letter ‘d’  copy line #10 to the end and print  again all text lines  compress the modified text lines so that one does not see the old line #10    Hamlet’s Soliloquy   To be or not to be, that is the question  Whether 'tis nobler in the mind to suffer  The slings and arrows of outrageous fortune,  Or to take arms against a sea of troubles  And by opposing end them. To die—to sleep,  No more; and by a sleep to say we end  The heart-ache and the thousand natural shocks  That flesh is heir to: 'tis a consummation  Devoutly to be wish'd. To die, to sleep;  To sleep, perchance to dream—ay, there's the rub:  For in that sleep of death what dreams may come,  When we have shuffled off this mortal coil,  Must give us pause—there's the respect  That makes calamity of so long life.

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
  1.  Write a program that collects from the user(keyboard) the first few lines of Hamlet.  Inputting text lines into the program should use cin.getline( …..) function. The program should contain the following parts: 
  • an  array of char pointers *ptr[15] – there are more char pointers than text lines 
  • declare a temporary char pointer (*tmp) 
  • declare a char Phrase[32] which is used to store temporarily each input line of Hamlet 
  • each new line of text  is stored in Phrase and should be copied onto the heap and its memory location assigned sequentially to ptr[i].  Recall that you must allocate memory on the heap via new memory function. 
  • after collecting all lines of text – print all input text lines (track # of input lines with int LineCnt) 
  • change each uppercase letter to lowercase on the entire text Hamlet 
  • print all text lines containing a punctuation symbol(; , . ?) 
  • print all text lines that contain the letter ‘d’ 
  • copy line #10 to the end and print  again all text lines 
  • compress the modified text lines so that one does not see the old line #10 

 

Hamlet’s Soliloquy  

To be or not to be, that is the question 

Whether 'tis nobler in the mind to suffer 

The slings and arrows of outrageous fortune, 

Or to take arms against a sea of troubles 

And by opposing end them. To die—to sleep, 

No more; and by a sleep to say we end 

The heart-ache and the thousand natural shocks 

That flesh is heir to: 'tis a consummation 

Devoutly to be wish'd. To die, to sleep; 

To sleep, perchance to dream—ay, there's the rub: 

For in that sleep of death what dreams may come, 

When we have shuffled off this mortal coil, 

Must give us pause—there's the respect 

That makes calamity of so long life. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 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