-
call this function?
Code:
void remove(string& text, int number_Array, int RemoveItem)
{
//initializing varaible
int i = 0; //setting array to start at position zero
int number_Array = 10; //setting the number in array to 10
i = text.find(RemoveItem);
while(i <= 10)
{
text.erase(i, 1);
i = text.find(RemoveItem, i);
}
return;
}
How can I call this function? I need to delte an item that is found within an array. I am not sure how to do this. Please give any assistance possible. Thank You
-
text is a string, not an array. It holds characters, not integers. So when you are looking for the int RemoveItem, you are actually finding the character whose character code is equal to the value of RemoveItem.
Can you give more context on what you are trying to do?
-
I am supposed to take an array of integers find one item in the array and delte the item.
-
Ok, then you need to have the function take an array, not a string. Does the array have a specific size? If it does, you can specify that size in the array parameter, otherwise you have to pass the size as a second parameter.
How much do you know about arrays?