yeah i forgot inplace so to do that we simply add count and ch in str
input array instead of op.
btw whats wrong with count it give me right answer.

On May 26, 12:08 pm, Hassan Monfared <hmonfa...@gmail.com> wrote:
> u forgot to do "inplace" and you have wrong conversion of count
>
> On Sat, May 26, 2012 at 11:31 AM, Anchal Gupta <anchal92gu...@gmail.com>wrote:
>
>
>
>
>
>
>
> > 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.

-- 
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