I have tried writting the following function to generate all combinations of a string by translating the algorithm from my algorithm text. But it keeps print entire string in the output for all the combinations.
len = strlen(str);
for(i=0;i<pow(2,len);i++) 
{
        for(j=0;j<len;j++) 
        {
                if(i && (0x1 << j)) 
                {
                        cout<<str[j];
                }
        }
        cout<<endl;
}
Thanks you all.