将一个长度为n的字符串向左循环移动m位
摘要:
// 将一个长度为n的字符串向左循环移动m位,如:hello,world向左移动3位就变成了lo,worldhel// 思路:把字符串切成长为m和n-m的两半,先分别对两部分进行逆序,最后对整个字符串逆序。#include <iostream>using namespace std;void ReverseString(char * const str, const int count);void RotateLeft(char *str, int num);int _tmain(int argc, char *argv[]){ char str[] = "hello,w 阅读全文
posted @ 2011-09-08 11:52 tujiaw 阅读(528) 评论(0) 推荐(0)
浙公网安备 33010602011771号