My task is this, and I'm having trouble finishing up the code:
Write a function named deleteS that accepts one character pointer as a parameter and returns no value. The parameter is a C string. This function must remove all of the upper and lower case 's' letters from the string. The resulting string must be a valid C string.
Your function must declare no more than one local variable in addition to the parameter; that additional variable must be of a pointer type. Your function may not use any square brackets.
int main()
{
char msg[50] = "She'll be a massless princess."
deleteS(msg);
cout << msg; // prints he'll be a male prince.
}
Here is what I've managed so far:
void deleteS (char* ptr[])
{
int*counter;
for (counter = ptr; counter<ptr + strlen(ptr); counter++)
{
if (isupper(*ptr + counter)
strcpy (" ", i);
else if (*(ptr + counter) == 's')
// delete the s, and move any blankspace back
I can't seem to come up with the remaining code. I hear that I can use a vector to delete elements (which is what I want to do), but I haven't learned that yet ..
How would I be able to finish up?