i trying count how many values in array wrongletters
letters. have developed below structure this, not produce correct values. appears loop double counting, value of used begins increase exponentially when ran in full program. recommendations on better way this?
for (int = 0; < 26; i++) { if (wrongletters[i] != 0) used += 1; // used counts how many alpha chars in array }
i trying count how many values in array
wrongletters
letters.
supposed have
std::string wrongletters; // input @ wrongletters
you can count alpha chars this
size_t alphachars = 0; for(auto c : wrongletters) { if(std::isalpha(c)) ++alphachars; }
Comments
Post a Comment