Character RemoVe from array Using Pointer funtion c++

#include<iostream.h>
#include<conio.h>
#include<string.h>
using namespace std ;

char*remove(char arry_1[], int size, int &a)
{
    //char point [size];
    char choice;
    cout<<" Which character U want to remove Baby : ";
     cin>>choice;
      cout<<" \n\n\n Your Result After RemovinG Your Character is == ";
     for( int i=0 ; i<size ; i++)
         {
          if (arry_1[i] != choice )
           {
                arry_1[a]=arry_1[i];
                a++;
               
            }
    }
        
         
         return arry_1 ;
       
 }
int main ()
{
    int a=0;
   
    string str ;
    cout<<"\n\n EnteR UR Word == ";
    cin>>str;
    int   size=str.size();
    char  arry_1[str.size()], *ptr;
 for(int i=0 ; i<str.size() ; i++)
    {arry_1[i]=str[i];}
    ptr =remove(arry_1,size,a) ;
   for(int y=0 ; y<a ; y++)
    cout<<ptr[y];
    cout<<"\n\n\n";
   
}
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment