Help with an assignment. Project due soon.

+1 Justo Rodriguez · November 22, 2015
I have an assignment where I have to replace every mention of one word with the second word in a given text. 

Example:
Mary had a little lamb
input: "Mary Alice"
Alice had a little lamb


I'm pretty sure that strcpy can help me do that, but I am not sure how to do that without replacing the entire text itself. Any help is really appreciated!

Post a Reply

Replies

Oldest  Newest  Rating
0 Aju Antony · November 23, 2015
Hi,

You can use the following blog to achieve what you need :)
http://www.c-program-example.com/2012/04/c-program-to-replace-sub-string-with.html

Since this is an assignment, I would suggest you go through the program and understand the basic mechanism the OP has used to solve the given problem. Then use the knowledge to write a programming mechanism of your own so that it would fit your custom need. :)

Happy Coding :D
  • 1

C

106,929 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator