标签:
void resize (size_t n); void resize (size_t n, char c);
测试代码:
// resizing string #include <iostream> #include <string> int main () { std::string str ("I like to code in C"); std::cout << str << ‘\n‘; unsigned sz = str.size(); str.resize (sz+2,‘+‘); std::cout << str << ‘\n‘; str.resize (14); std::cout << str << ‘\n‘; return 0; }
标签:
原文地址:http://www.cnblogs.com/icode-girl/p/5365004.html