c++ - For loop adding to a variable -
i trying create loop adds 1 int variable every time if statement true
but while testing code though if statement true variable not incremented, if loop not incremented @ all....
code sample:
int left_jab_count; if(area >=100000 && area1 <100000) { cout<<"left jab has been thrown"" "<<area<<endl; for(int left_jab_count = 0; left_jab_count < 0 ;++left_jab_count) { cout<<"left jab :"<<left_jab_count<<endl; } }
can see going wrong here ?
for(int left_jab_count = 0; left_jab_count < 0 ;++left_jab_count) //^^^^left_jab_count never < 0 // change <0 value larger 0
you for
loop never executed. therefore, left_jab_count
never incremented, never enter body of for
loop.
meanwhile, declared left_jab_count
twice.
Comments
Post a Comment