0
How can I check length of string in this code?
2 Respuestas
+ 2
You declared `char string[20];`
It is a C-String, a char array, it is not a std::string. Your condition `if (string.size() >= 8)` doesn't work, because a char array doesn't have any method by the name 'size'.
+ 2
You can use the sting type instead of a char array. The string type has a length() method that returns the strings length.