While implementing the search and replace functionality, you ma

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question
100%

The code should be in C++, the hints for this are...

1. To search for a word in a line of text, you may use the find() function that
works with C++ string objects.
2. While implementing the search and replace functionality, you may need to make
a temporary copy of the text file.

In this project, you are tasked with developing a console-based text-editor. The required
functionalities for your text-editor are as follows:
1. View contents of the user-specified text file.
2. Create a new text file.
3. Write text to the user-specified text file.
4. Add/append text to the user-specified text file.
5. Search for a word in the user-specified text file and display ALL locations (the
line numbers) where the word appears.
6. Replace ALL occurrences of an existing word with another word in the user-
specified text file.
Transcribed Image Text:In this project, you are tasked with developing a console-based text-editor. The required functionalities for your text-editor are as follows: 1. View contents of the user-specified text file. 2. Create a new text file. 3. Write text to the user-specified text file. 4. Add/append text to the user-specified text file. 5. Search for a word in the user-specified text file and display ALL locations (the line numbers) where the word appears. 6. Replace ALL occurrences of an existing word with another word in the user- specified text file.
At the start of your program, it should display a menu listing possible choices for the
user which should highlight various features of your text-editor. Depending on the user's
choice, your program should run the appropriate task and display appropriate messages.
Once the task is complete, your program must return to the main menu. In case of an
error, your program must gracefully handle the error (for instance, if the specified text
file does not exist, your program should display an appropriate error message and return
to the main menu).
You are NOT required to use any graphical elements in your program.
Transcribed Image Text:At the start of your program, it should display a menu listing possible choices for the user which should highlight various features of your text-editor. Depending on the user's choice, your program should run the appropriate task and display appropriate messages. Once the task is complete, your program must return to the main menu. In case of an error, your program must gracefully handle the error (for instance, if the specified text file does not exist, your program should display an appropriate error message and return to the main menu). You are NOT required to use any graphical elements in your program.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

So, there is a infinite loop after needing to press ctrl+z and enter after adding text to the file, and when I do the append text, the ctrl+z+enter doesn't work, this also blocks me from searching for a word and replacing words.

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
File Input and Output Operations
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT