字符传逆转函数
来源:互联网 发布:java中replace的用法 编辑:程序博客网 时间:2024/05/16 07:20
#include <iostream>
#include <cmath>
using namespace std;
void reverse(char *s)
{
cout<<*(s)<<endl;
if (!*s) return;
reverse(s+1);
while (*++s)
swap(*(s-1), *s);
}
int main(){
char a[100];
cin>>a;
int len=strlen(a);
for(int i=0;i<len;i++)
cout<<a[i];
cout<<endl;
reverse(a);
for(i=0;i<len;i++)
cout<<a[i];
return 0;
}
#include <cmath>
using namespace std;
void reverse(char *s)
{
cout<<*(s)<<endl;
if (!*s) return;
reverse(s+1);
while (*++s)
swap(*(s-1), *s);
}
int main(){
char a[100];
cin>>a;
int len=strlen(a);
for(int i=0;i<len;i++)
cout<<a[i];
cout<<endl;
reverse(a);
for(i=0;i<len;i++)
cout<<a[i];
return 0;
}
- 字符传逆转函数
- 字符逆转
- 3-1 编写并测试一个函数,逆转字符串中字符顺序
- 字符串逆转函数_INTEL2014笔
- getchar和逆转5个字符大小的字符串
- 字符数组或字符串逆转的几种方法
- ASP中的Server.URLEncode参数转换以及逆转函数
- mysql的yearweek()函数转换与逆转换。
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- 字符函数
- Java入门需掌握的30个基本概念
- javascript 进度条
- 蓝牙协议读书笔记
- 使用面向对象工具进行着面向过程的开发
- 交叉编译场景分析(arm-linux)--序
- 字符传逆转函数
- 1 面向对象的特征有哪些方面
- 新手上路
- 切·格瓦拉魅力长存的传奇战士
- 2 String是最基本的数据类型吗?
- 3 int 和 Integer 有什么区别
- 交叉编译场景分析(arm-linux)(一)--基本知识
- 交叉编译场景分析(arm-linux)(二)--编译tslib
- 火影忍者377话在线观看更正版