.size函数时间:2025-02-11 18:51:13size()函数: c++中,在获取字符串长度时,size()函数与length()函数作用相同。 除此之外,size()函数还可以获取vector类型的长度。 例如:vector < int> num(15,2) ,则:() = 15。