#include <iostream>
#include <string>
#include <algorithm>
using namespace std ;
namespace Myspace {
string reverseWords(string& sentence) {
string reversedSentence = sentence;
reverse(reversedSentence.begin(), reversedSentence.end());
return reversedSentence;
}
}
int main() {
string sentence = "Hello World";
string reversedSentence = Myspace::reverseWords(sentence);
cout << reversedSentence << std::endl;
return 0;
}
总结:有道云笔记链接