I need help in writing a fuction call delete_repeats that has a partially filled array of chararcters as a formal parameter and that delets all repeted letters from the array. It should also have two formal parameters: an array parameter and a formal parameter of type int that gives the number of array position used and when the letters are deleted the remaining letters are moved forward to fill in the gap. So far this is what I have :

const max=30;
    char used [max];
    cout<<"Type in a word";
    for (int i=0;i<size-1; i++)
    for (int j=i+1; j<size; j++)
        if (word[i]==word[j])
        delete_repeat(       )
    void delet_repeat(char w[  ],int size)
         for (s=j;s<size-1;s++)

im very lost in this :?:

11 Years
Discussion Span
Last Post by Nick Evan

please edit your post to use code tags. If you don't know how to use them you can find the instructions in the link in my signature below.


lets say you have
char sMyString[6];

0 1 2 3 4 5
[A] [R] [R] [A] [Y] [\0]

you call delete_repeats ( sMyString, 0 );

so basically you want to delete A at position 3, but you cant just move everything to the right of it to the left. that would be too easy... think of a way to copy or move the positions after your target letter to the left ...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.