Đảo ngược thứ tự từng ký tự trong chuổi

#include<iostream> using namespace std; #include<string> #include<string.h> int main() { // 0123456789 string s="anh chuc dep trai "; string s1=s.substr(0,3); string s2=s.substr(4,4); string s3=s.substr(9,3); string s4=s.substr(13,4); strrev((char *)s1.c_str()); strrev((char *)s2.c_str()); strrev((char *)s3.c_str()); strrev((char *)s4.c_str()); cout<<"\n"<<s1<<" "<<s2<<" "<<s3<<" "<<s4<<"\n"; system("pause"); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.