c++ - How to create a for loop to check every character in a string for lowercase letters? -
hi wondering if please help me understand why every time seek run code runs abort gets it. when have within password.at(i). when replace int such 0 or 1 works correctly checks character. need able check entire string see if has lowercase character. thanks!
int check = 0;
for(int = 0; <= password.size(); i++) { if(islower(password.at(i)) != 0) { check++; } }
your loop command should be
for(int = 0; < password.size(); i++)
the way had it, index outside array. can index 0 size-1.
c++ string for-loop member-functions
No comments:
Post a Comment