您的位置:首页 > 其它

FZU-1054 阅读顺序(水、反转字符串处理)

2016-04-24 09:15 525 查看

FZU-1054 阅读顺序(水、反转字符串处理)

题目链接

题意:反转字符串

#include"iostream"
#include"cstring"
#include"cstdio"
using namespace std;
int main(){
int t,i,len;
char s[250];
scanf("%d",&t);
getchar();
while(t--){
gets(s);
len = strlen(s);
for(i=len-1; i>=0; i--){
printf("%c",s[i]);
}
printf("\n");
}
return 0;
}


其实还有更简单的,直接调用C语言库里的反转字符串函数strrev(),必须用Visual C++/C提交一般GUN里面木有这个函数

#include"cstring"
#include"cstdio"
using namespace std;
int main(){
int t,i,len;
char s[250];
scanf("%d",&t);
getchar();
while(t--){
gets(s);
printf("%s\n",strrev(s));
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: