字串反轉reverse函式與assign函式
阿新 • • 發佈:2021-01-05
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string str="11111sad";
reverse(str.begin(),str.end());
cout<<str;
}
#include<iostream>
#include<string>
using namespace std;
int main ()
{
string str="11111sad",str1;
str1.assign(str.rbegin(),str.rend());
cout<<str1;
}