c++ 循环左移

char c[11] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};
	const int iRightShift = 8;
	for (int j = 0; j < iRightShift; j++){//循环左移
		char pTem = c[strlen(c) - 1];
		for (int i = strlen(c) - 1; i >= 0; i--){
			if (i == 0){
				c[i] = pTem;
			}
			else{
				c[i] = c[i - 1];
			}
		}
	}
	printf("%s\n", c);

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

 

posted @ 2015-06-29 20:39  QQ76211822  阅读(704)  评论(0编辑  收藏  举报