int count(string s){
if(s == "")
return 0;
if(s.length == 1)
return 1;
return 1 + count() //This is what I can't figure out. How to traverse the string.
//I just need a hint, not a full on answer.
}
我不知道如何遍历一个字符串。
最佳答案
关于c++ - 尝试在 C++ 中使用递归确定字符串的长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13816457/