vendredi 13 mai 2022

I need a function to delete certain characters from a char array in c++ without using any index

for example: if the user enters : ( 23+22+43)

I want the function to do exactly the following :

for(int i =0; i <strlen(x);i ++)
{
   if (x[i]=='+')
   {
     deletfunc(x[i]);
     deletfunc(x[i+1]);
     cout<<x;
   }
}

so that the output will be (2323)

without using index ----> without knowing the exact number of the char in the array for example I couldn't say deletefunc[3] , I don't know if + is the 3rd or 4rth or 2nd element and so on and the + maybe repeated more than once.

Please if anyone can help I had been trying do this task for 4 days now

Aucun commentaire:

Enregistrer un commentaire