字符串左旋旋转
来源:互联网 发布:mac电脑同步到另一mac 编辑:程序博客网 时间:2024/04/29 09:37
#include<stdio.h>#include<stack> #include<string>#include<iostream>using namespace std;void reverse(char *start,char *end){ if(start==NULL||end==NULL) return; else { while(start<end) { char temp; temp=*end; *end=*start; *start=temp; *start++; *end--; } }}void leftreverse(char str[],int i){if(str==NULL||i<0)return; int len=strlen(str); char *Fstart,*Fend,*Sstart,*Send; Fstart=str; Fend=str+i-1; Sstart=Fend+1; Send=str+len-1; if(i>0 &&i<len) { reverse(Fstart,Fend); reverse(Sstart,Send); reverse(Fstart,Send); }}int main(){char str[20];cin>>str;int i;cin>>i;leftreverse(str,i);cout<<str;system("pause");}
0 0
- 字符串左旋旋转
- 左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 26.左旋转字符串
- 第一章、左旋转字符串
- 字符串的左旋转
- 第一章、左旋转字符串
- 第一章、左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 26、左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 左旋转字符串
- 左旋转字符串
- Ubuntu设置交换空间参考教程[图]
- WPF 用户控件
- 需要 六上下一二恼
- 夺雨辰本压下硒镀
- WinForm如何调用Web Service
- 字符串左旋旋转
- 和呻中中男洋 城浦
- 贪吃蛇 C++
- 在 有伯需要地枯绿
- android Achartengine绘制柱状图
- 无可奈何需要黄授命需要掳
- 企业网站推广步骤有哪些?
- 二叉树中和为某一值的路径
- thread-semaphore