I want my std::cout
to print 000111222333 ...
, but what i'm getting instead is 0111222333 ...
, and i don't know why, here is my code:
int threeCounter =1;
int outPut =0;
for (int i =0; i<300;i++){
if(threeCounter > 3 ){
outPut++ ;
threeCounter=1;
}
cout << outPut << endl;
threeCounter++;
}
I tried the very same code in matlab, and it's producing the correct sequence:
threeCounter=1;
outPut =0;
for i =1:300
if(threeCounter >3)
outPut=outPut+1;
threeCounter=1;
end
disp(outPut)
threeCounter=threeCounter+1;
end