88问答网
所有问题
编程实现:从键盘输入一个字符串,然后将其逆序保存,最后输出显示。
例如:输入“abc”,输出“cba”
用c++
举报该问题
推荐答案 2009-04-29
#include<iostream.h>
#include<string.h>
void main()
{
char s[100],tmp;
cin>>s;
int len=strlen(s); //获得字符串长度
for(int i=0;i<len/2;i++)
{
tmp=s[i];
s[i]=s[len-i];
s[len-i]=tmp;
}
cout<<s<<endl;
}
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://88.wendadaohang.com/zd/BVtcacag.html
相似回答
大家正在搜