You should first fix the code, as it stands it wouldn't compile.
To get stepwise output, you have to, well, write the output at each step, e.g.
do
{
int r= number % 10;
if(r%2==0)
first+=r;
else
second+=r;
cout << "number: " << number << ", r: " << r << ", first: " << first << ", second: " << second << endl;
number/=10;
} while (number>0);