摘要: 查找字符串(C++实现),不使用库函数:// SubString.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;bool FindSubString(char* srcStr,char* subStr){ char* p = srcStr; char* q = subStr; if(p ==NULL || *p== '\0') return false; while(p != NULL) { //subStr 循环比较结束 if(... 阅读全文
posted @ 2013-10-12 15:47 Jamy Cai 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 字符串右移n位(C++实现):// ShiftNString.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;void Reverse(char* begin, char* end){ char temp; while(begin < end) { temp = *begin; *begin++ = *end; *end = temp; end --; }}void Shift(char* str,int n){ in... 阅读全文
posted @ 2013-10-12 15:10 Jamy Cai 阅读(1562) 评论(0) 推荐(0) 编辑
摘要: 字符串反转 C++实现,不使用系统函数:// ReverseString.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;char* ReverseString(char* str){ char* p = str; char* q = str; char temp; while(*q != NULL && *q != '\0') { q ++; } q --; while(p < q ) { temp = *p; ... 阅读全文
posted @ 2013-10-12 15:07 Jamy Cai 阅读(838) 评论(0) 推荐(0) 编辑