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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started