/*
Name: 反转字符串
Copyright: tarena
Author: 王钟沛
Date: 07-11-06 19:09
Description: 输入一串字符,对其进行反转
*/
#include <iostream>
using namespace std;
void rollback( char *ch )
{
int length = strlen( ch );
for( int i=0; i<length/2; i++ )
{
char temp=ch[i];
ch[i] = ch[length-1-i];
ch[length-1-i] = temp;
}
}
int main()
{
char ch[255];
cout << "请输入一串字符:" ;
cin >> ch;
rollback( ch );
cout << ch << endl;
system("PAUSE");
return 0;
}