DS:串的简单匹配
来源:互联网 发布:淘宝网宝贝主图尺寸 编辑:程序博客网 时间:2024/06/06 00:07
首次匹配成功,返回待匹配的字符串 data 在 字符串 str 的首个元素位置;否则,返回0:
// STACK.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include<stdio.h>#include<stdlib.h>#include<malloc.h>#include<time.h>#include<string.h>int compare(char*str,char*data);int main(){char str[30]="sdfhjffdkkkdkdhkdhslklk",data[10]="fdkkkd";puts(str);puts(data); printf("\nsince %dth member(the string begin with 0)\n",compare(str,data));return 0;}int compare(char*str,char*data){int j=0;for(int i=0;str[i]!='\0';i++){if(str[i]==data[j]){for(j=1;data[j]!='\0';j++){if(str[i+j]!=data[j]){j=0;break;}}if(data[j]=='\0')return i;}}return 0;}
阅读全文
0 0
- DS:串的简单匹配
- 【DS】一些简单数
- 简单的串的匹配kmp
- 用3DS MAX制作简单的动画
- 串的模式匹配简单算法
- 关于串匹配的简单理解
- 简单的括号匹配
- 简单的括号匹配
- 简单的正则匹配
- DS:串的链式存储结构
- 串简单模式匹配
- 简单的括号匹配算法
- 简单的字符串匹配 poj1936
- 简单的字符串近似匹配
- 字符串的简单模式匹配
- 简单的字符串模式匹配
- 括号的匹配(简单)
- 简单的字符串匹配算法
- 回溯题目/排列、组合、子集问题
- poj 3009
- 【HDU 1045】Fire Net(DFS,check函数)
- 写第一篇博文
- vm-c
- DS:串的简单匹配
- 关于MySql的SSL-Connection
- 牛客《剑指Offer》 -- 数值的整数次方
- (三) u-boot 启动分析_第一阶段
- Stm32 烧程序出现 Error:Flash Download Failed-"Cortex-M3"对话框解决方案
- 23种设计模式之——装饰模式
- oracle 12c 中scott账户与表问题
- HDU 6034 Balala Power!(贪心)
- 螺旋二维数组