标准库string里面有个函数size,用来返回字符串中的字符个数,具体用法如下:string st("The expense of spirit\n");cout << "The size of "<<st<<"is"<<st.size() << "characters, including the newline"<<endl;那么size()这个函数…
size() 标准库string里面有个函数size,用来返回字符串中的字符个数,具体用法如下: string st("The expense of spirit\n");cout << "The size of "<<st<<"is"<<st.size()<< "characters, including the newline"<<endl; 那么s…