STL反转函数reverse

简介: STL反转函数reverseSTL反转函数reverse
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string>
#include<algorithm>  
#include<map>
#include<vector>
#include<queue> 
using namespace std;  
int main(){   
  string str="C++REVERSE";
    reverse(&str[0],&str[3]);//注意翻转的是前三个字符,别漏了&
  reverse(str.begin(),str.end());
    cout<<str;
  system("pause");
    return 0;   
}
相关文章
|
11月前
|
算法 Java C++
27.【C/C++ 最全vector数组的用法 (详解)】(一)
27.【C/C++ 最全vector数组的用法 (详解)】
185 0
|
2月前
|
存储 安全 算法
C++的内置数组和STL array、STL vector
C++的内置数组和STL array、STL vector
|
3月前
|
Python
reverse函数
reverse函数。
28 0
|
3月前
|
C++
【STL】:反向迭代器
【STL】:反向迭代器
37 0
|
10月前
|
编译器 C++ 容器
【STL】模拟实现反向迭代器
【STL】模拟实现反向迭代器
27 1
|
12月前
【C++STL】list的反向迭代器
【C++STL】list的反向迭代器
51 0
|
C++ 容器
C++【STL】之反向迭代器
C++ STL 反向迭代器设计思想和模拟实现详细讲解,干货满满!
111 0
C++【STL】之反向迭代器
【leetcode】【27、移除元素】双指针和STL库函数求解
【leetcode】【27、移除元素】双指针和STL库函数求解
|
算法 容器
使用迭代器输出vector里面的元素
使用迭代器输出vector里面的元素
72 0
|
C++
旋转数组STL(reverse)
题目: 给定一个数组,将数组向右移动k步,其中k为非负数。 样例:
74 0