Search

문자열을 뒤집을 수 있는 reverse 함수

생성일
2023/02/03 06:27
태그
C++

문자열을 뒤집을 수 있는 reverse 함수

헤더 파일

#include <algorithm>
C++
복사

ex)

#include<iostream> #include<algorithm> //reverse #include<string> //string using namespace std; int main(void) { string str = "BlockDMask"; cout << "=> reverse(str.begin(), str.end());" << endl << endl; cout << "Before : " << str << endl; //"BlockDMask" reverse(str.begin(), str.end()); cout << "After : " << str << endl; //"ksaMDkcolB" return 0; }
C++
복사