By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 1,014 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

search and replace operation in a text editor

P: 1
I need a program that simulates the search-and-replace operation in a text editor. The program is to have only three function calls in main. The first function prompts the user to type a string of fewer than 80 characters. It then prompts the user to type the search-substring of 10 or fewer characters. Finally, it prompts the user to type the replace-substring of 10 or fewer characters.

The second function call is the search-and-replace function, which replaces all occurrences of the search-substring with the replace-substring and creates a new string. If no occurrences are found, it returns the original string. Theoretically, the new string could be 800 characters long (80 identical characters replaced by 10 characters each). The search-and-replace function returns the address of the new string.

The third call is a print fruition that prints the resulting string as a series of 80 character line. It performs word-wrap because a line can end only at a space. If there is no space in 80 characters, then print 79 characters and a hyphen and continue on the next line.
Feb 14 '07 #1
Share this Question
Share on Google+
1 Reply


Ganon11
Expert 2.5K+
P: 3,652
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve. This question will now be closed and you will have to post a new question when you're ready.

MODERATOR
Feb 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.