Hi everyone!I've started to learn C++ couple of months ago and having some trouble with the code i'm trying the write.. I have to write a function that converts every digit of the parameter to zero,except 2.And number of digits is unknown..
I made this but its's output is always 0.Even i enter a number that contains 2...I'll be glad if you could help..Thanks
What I could get out of your unformatted code was
if(remainder==2)
remainder=2;
if(remainder!=2)
remainder=0;
should be better : if(remainder==2)
remainder=2;leave this away-->if it IS 2 why set it to 2 ?
if(remainder!=2) remainder=0;-->+-OK, because if you want to print 2 it will print 0
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.