Question: Write a function of removeChar() that removes all the occurrences of a character in a string. For example, given a string of YSU ?Foot??ball and

Write a function of removeChar() that removes all the occurrences of a character in a string.

For example, given a string of YSU ?Foot??ball and a ? character, the resulting string is YSU Football.

You can assume that the string can be modified. Note that there is no standard solution.

You will receive full credit as long as the code meets the following requirements.

1. In the main function, ask the user to enter a string and a character to be removed.

2. The entered string should be handled as a C-string (or is converted to a C-string).

3. Write a removeChar function that takes a pointer parameter (char *) and a char parameter.

4. In the main function, print out the original string and the new string with the character being removed.

5. The removeChar function should be implemented using the pointer notation only.

6. Using a non-pointer notation will result in a 3-point deduction.

7. Using library functions will result in a 3-point deduction. However, you can use the strlen() function

to get the length of a string and cin.get() to take a whitespace character from the keyboard.

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!