Question: Exercise P7.13. Write a program that reads lines of text and appends them to a char buffer [1000]. Stop after reading 1,000 characters. As you

 Exercise P7.13. Write a program that reads lines of text andappends them to a char buffer [1000]. Stop after reading 1,000 characters.As you read in the text, replace all newline characters 'In' with'\o' terminators. Establish an array char* lines[100], so that the pointers in

Exercise P7.13. Write a program that reads lines of text and appends them to a char buffer [1000]. Stop after reading 1,000 characters. As you read in the text, replace all newline characters 'In' with '\o' terminators. Establish an array char* lines[100], so that the pointers in that arr . Only consider 100 input lines if the input has more lines. Then display the lines in reverse order, starting with the last input line. ay point to the beginnings of the lines in the text Problem P7.13 . Comment #1: Use getline to read in the text. After each line is read in, ask the user if more text is expected (y). If "y", then read in the next line, otherwise stop the input. Do not let the input to be more than 100 lines. If the buffer maximum capacity 1000 is reached then stop the input. Also, if a line cannot be placed into the buffer without being cut, then stop the input. See the sample of input-output for details. . Comment #2: Note please that replacing" n, with 0, when one appends lines into buffer is not necessary. Here is the reason for that. The getline function removes the new line character ' n after it reads in the line. In addition, to append the content of the string used in getline to buffer one may to use the function strcpy or strcpy-s which only deals with C-style strings. The method of the string class that returns C-style string, called c.str), will automatically add \0 to the C-style string. Submit the solution in the file named hmw.6.3.cpp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!