Can you please help me find digits in string without using functions like isdigit? I can only use for loop and pointers. If I have
std::string s {"A year has 365 days"}
Why can't I do something like this:
for (int i=0; i<s.size(); i++){ while (s[i]>='0' && s[i]<='9) v[i].push_back(s[i]); }
I know this would store digits 3 6 and 5 in vector and not number 365. But I don't understand why my while loop doesn't work.
Aucun commentaire:
Enregistrer un commentaire