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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -