c 循环左移

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

 

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

 

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