编写一个函数 loopMove 实现字符串的循环右移功能
程序代码:[local]1[/local]#include <stdio.h>
#include <string.h>
void loopMove(char *str,int n)
{
int i,j,strLength;
char tmp;
strLength = strlen(str);
for(i = 0 ; i < n ; i++)
{
tmp = str[strLength-1];
for(j = 0 ; j < strLength-1 ; j++)
{
str[strLength-j-1] = str[strLength-j-2];
}
str[0] = tmp;
}
}
main()
{
char *str = "abcdefghijklmn";
printf("The original string is %s\n",str);
loopMove(str,6);
printf("The string be loopmoved is %s\n",str);
getchar();
}
/*我最后运行咋会跳出个这样的框?*/









