Thread: call this function?

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    2

    Wink 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

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    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?

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    2
    I am supposed to take an array of integers find one item in the array and delte the item.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    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?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM