reverse的作用: 答:将区间[iterator1,iterator2)内的元素反转。使用时包含algorithm头文件,打开std命名空间。 int main() { string a = "hello world!"; reverse(a.begin(),a.end());//!dlrow olleh cout << a; string b="hello world!"; reverse(a.begin(),a.begin()+5); //olleh world! cout<<b; }