hey, here is the function that do the compression and store the output
in an array op.


void str_comp(char *str)
{
  int count=0,j=0,i;
  char ch,op[100];

  for(i=0;i<strlen(str);)
  {
    ch = str[i];
    while(str[i] == ch)
      { count++;
        i++;
      }
     op[j] = count+48;
     op[++j] = ch;
     j++;
     count=0;

   }
   cout<<"input : ";
   for(i=0;i<strlen(str);i++)
    cout<<str[i];

   cout<<"\n\noutput : ";
   for(i=0;i<j;i++)
    cout<<op[i];

 }



Best Regards
Anchal Gupta
USIT(GGSIPU), Delhi
+91-9015897983




-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to