#include <iostream> #include <string> #include <sstream> #include <fstream> #include <Windows.h> using namespace std; int main() { char str[MAX_PATH]; memset(str, 0, MAX_PATH); while (true) { cout << "input your string: " << endl; cin >> str; int len = strlen(str); for (int i = 0; i < (len + 1) / 2; i++) { char temp = str[i]; str[i] = str[len - 1 - i]; str[len - 1 - i] = temp; } cout << "result:" << str << endl; getchar(); } return 0; }