Question: Display menu options Ask the user to select an option Switch on option case s : Call a function to: search the specified string in

Display menu options
Ask the user to select an option
Switch on option
case s :
Call a function to:
search the specified string in the worked on string
if found, display its index in the worked on string
otherwise display not found
case a:
Call a function to:
Append the specified string at the end of the worked on string
ifDisplay the updated string
case i:
Call a function to:
Validate the specified insert index for valid range.
If invalid, display notification message.
Otherwise, insert the specified string at the specified index
case d:
Call a function to:
Search for the string to be deleted.
If found, remove it from the worked on string
Otherwise, display not found
case r:
Call a function to:
Search for the string to be replaced
If found, replace it with the replacing string
Otherwise, display String to be replaced, Not found
case e:
end the program.
IMPLEMENTATION
Use the following c library functions:
strlen
strcpy
strcat
strncmp
NOTE: strcpy and strcat functions have updated versions. You need to worry only about the naming of the functions as given below. The parameter list is the same. Most compilers will let you use the old versions but Visual Studio will suggest the new versions:
strcpy -----> strcpy_s
strcat =====> strcat_s
Use the following user provided functions:
int search (char sourceString [], char targetString [])
{
/*
The function below will take a source string and a target string. It will search for the target string in the
source string. If the string is found, it will return its index in the source string. Otherwise, it will return -1
In each pass through the loop, it starts at a different index in the source string
and compares it with the target string.
In the first pass, it starts at index 0 in sourceString and compares it with targetString.
In the second pass, it starts at index 1 in sourceString and compares it with targetString
and so on.
If it finds a match, it breaks out of the loop and returns the index of the sourceString where
the match was found,
otherwise it returns -1(the value at which the index was initializ

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 Programming Questions!