so easy!
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *fzstr(char *str)
{
int i,j;
for(i=0,j=strlen(str)-1;i<j;i++,j--)
{
//通过位运算交换数值
str^=str[j];
str[j]^=str;
str^=str[j];
}
}
int main()
{
char str[10001];
gets(str);
fzstr(str);
puts(str);
system("pause");
return 0;
}
[/mw_shl_code]随手就能写出。[url=]呲牙[/url]
[url=]
[/url]
|