摘要:
查找字符串(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(... 阅读全文
摘要:
字符串右移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... 阅读全文
摘要:
字符串反转 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; ... 阅读全文