C++ 程序:反转字符串,将 'Hello World' 变为 'droW olleH'
#include
using namespace std;
int main() { string str = 'Hello World'; string reversedStr = '';
for (int i = str.length() - 1; i >= 0; i--)
{
reversedStr += str[i];
}
cout << reversedStr << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/oJ0U 著作权归作者所有。请勿转载和采集!