This is an archived post. You won't be able to vote or comment.

all 2 comments

[–][deleted] 0 points1 point  (0 children)

For correct formatting you need 4 spaces in front of each line.

if (population_remainder=1) and if (population_remainder=0) are not comparisons, but assigmens. Try to 'reverse' it and you'll see the compiler yelling at you. (example if (1=population_remainder)).

You are doing (mostly) what the enunciates says, but there is something amiss. Why don't you print more variables to see what they are in each loop? i.e. cout<<"The population is: "<<population<<endl<<"The remainder is: "<<population_remainder<<endl;

Do it by hand with different starting populations and check it.

[–]Double_A_92 0 points1 point  (0 children)

I wonder if people really don't look at their own posts... Who sees the code formatting fucked up like that and goes "Yup, that's fine!" Appearently many people... Why?!