旋转

来源:互联网 发布:android漂亮界面源码 编辑:程序博客网 时间:2024/04/28 19:35
#include <stdio.h>
#include <string.h>
#define N 50
#define M 100


int main()
{
char s[N];
char s1[M];
int n;
int p;
int i ,j;
printf("The string you want to input:\n");
scanf("%s",s);
strcpy(s1,s);
strcat(s1,s);
n = strlen(s) ;
printf("The length of string you input is: %d\n",n);
printf("Please input the location you want to reserve: ");
scanf("%d",&p);
for(i = p + 1,j = 0;i < p+1+n;i++,j++)
{
s[j] = s1[i];
// printf("%s\n",s1);
}
printf("%s\n",s);
    return 0;
}
0 0
原创粉丝点击