1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| /**
* @param position pointeur sur le tableau de position à allouer et remplir
* @param s occurence à trouver
* @param b begin
* @param end end
* @param length longeur du tableau de position (interne à la fonction)
* @param uniq par la suite évitera les doublons (ne sert à rien pour l'instant)
*/
void TChaine::find_char (int *position, const char s, int b, int end, int length, int uniq)
{
int i=b;
for (;i<end;i++)
{
if (mChaine[i] == s)
{
l++;
cout << "caractère présent (" << length << ") : " << i << "\n";
find_char (position, s, (i+1), end, length, uniq);
*(position+length-1) = i;
break;
}
}
if (i==end)
{
position = new int[length];
cout << "initialisation du tableau success \n";
}
} |
Partager