c++ - how do you change arrays? -


help! im trying replace 'a' , 'e' ' ' in array keeps replacing of array instead.

    for(int x = 0; x < array_length); x++)     {        if(city_name[x] == 'a' || 'e')         city_name[x] = " ";     } 

if(city_name[x] == 'a' || 'e') 

should be

if(city_name[x] == 'a' || city_name[x] == 'e') 

your code equivalent to

if( ( city_name[x] == 'a' ) || 'e') 

which city_name[x] == 'a' , checks result of statement || 'e'


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

python - Exception while importing pymorphy2 -