本文共 596 字,大约阅读时间需要 1 分钟。
#include <cstdlib>#include <iostream>#include <algorithm>using namespace std;const int MAX = 80;int main(int argc, char *argv[]){ //freopen("input.txt", "rt", stdin); //freopen("output.txt", "wt", stdout); char ch[MAX]; int flag = 0; while(cin.getline(ch, 80)) { if(flag == 0) { flag = 1; continue; } int size = strlen(ch) - 1; int hafSize = (size + 1) / 2; for(int i=0; i<hafSize; i++) swap(ch[i], ch[size - i]); cout << ch << endl; } return EXIT_SUCCESS;}
转载地址:http://kdkqb.baihongyu.com/