Write a c++ 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[120] 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.
Write a c++ 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[120] 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.
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
Related questions
Question
- Write a c++
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[120] 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
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education