how to calculate the length of a string in cpp code example Example: length of string in c++ str.length();