国产女人18毛片水真多18精品, 一区二区三区中文字-亚洲精品女国产, 欧美熟妇老熟妇88888久久久久, 一级毛片免费观看亚洲欧美国产精品,大波霸美女视频,日韩欧美激情V影院,熟女人伦21p,亚洲精品女国产,国产 乱子伦 在线

C語(yǔ)言之字符串模糊查詢方法的實(shí)現(xiàn)

時(shí)間:2025-08-17 08:11:30 C語(yǔ)言

C語(yǔ)言之字符串模糊查詢方法的實(shí)現(xiàn)

  字符串模糊查詢,主要是輸入不完全的信息進(jìn)行查找,即每次查找的是待查詢的內(nèi)容中是否含有輸入的內(nèi)容,如果有,則表示找到了。下面詳細(xì)的介紹下模糊查詢的實(shí)現(xiàn)方法,一起看看吧!

  代碼如下:

  #include <stdio.h>

  #include <stdlib.h>

  #include <string.h>

  int main(int argc, const char * argv[])

  {

  char str[] = "hello welcome to china"; /pic/p>

  printf("input a string:n");

  char str2[20];              /pic/p>

  fgets(str2, 19, stdin);

  char *res;

  res = memchr(str, str2[0], strlen(str));  /pic/p>

  if (res == NULL)

  {

  printf("find nothing...n");

  return 0;

  }

  int n;

  while (1)

  {

  n = memcmp(res, str2, strlen(str2) - 1); /pic/p>

  if (n != 0)

  {

  if (strlen(res) <= strlen(str2))  /pic/p>

  {

  printf("find nothing...n");

  return 0;

  }

  else

  {

  /pic/p>

  res = memchr(res + 1, str2[0], strlen(res));

  if (res == NULL)

  {

  printf("find nothing...n");

  return 0;

  }

  }

  }

  else

  { /pic/p>

  printf("%s is found..n", str2);

  return 0;

  }

  }

  }


【C語(yǔ)言之字符串模糊查詢方法的實(shí)現(xiàn)】相關(guān)文章:

C語(yǔ)言之字符串處理函數(shù)03-12

C語(yǔ)言字符串操作函數(shù)及常用的實(shí)現(xiàn)03-16

C語(yǔ)言中返回字符串函數(shù)的實(shí)現(xiàn)方法03-22

C語(yǔ)言字符串操作函數(shù)和常用的實(shí)現(xiàn)03-20

C語(yǔ)言實(shí)現(xiàn)返回字符串函數(shù)的方法有哪些01-02

C語(yǔ)言字符串07-30

c語(yǔ)言之符號(hào)的技巧12-10

關(guān)于字符串的組合算法問(wèn)題的C語(yǔ)言實(shí)現(xiàn)攻略10-19

實(shí)現(xiàn)c語(yǔ)言中字符串和數(shù)字的相互轉(zhuǎn)換的代碼12-13