头文件中一般来说不应包含Using声明
string size()返回无符号整数,类型是size_type
s.size()<n;//n为负值int型,会把n自动转换成无符号类型,(n+(n mod 256))
C风格的字符串
C风格的字符串存放在字符数组中并以空字符结束(null terminated, ‘\0’)
char ca[] = {'c','+','+'}; //不以空字符结束
cout << strlen(ca) << endl;//严重错误
比较字符串
//比较标准库string对象
string s1 = "A string example";
string s2 = "A different string";
if(s1<s2)//false:s2 小于s1
//比较C风格字符串
const ca1[] = "A string example";
const ca2[] = "A different string";
if(ca1<ca2)// 实际上比较的是指针。