zoukankan      html  css  js  c++  java
  • 字符串查找相同字母代码

    int char_contains(char str[],char c)
    {
        //方法1:
        int len=strlen(str);
        for (int i=0; i<len; i++)
        {
            if (str[i]==c)
            {
                return 1;
            }
        }
        return 0;
        //方法2:
        int i=0;
        while (str[i]!='')
        {
            if (str[i]==c)
            {
                return 1
    ;
            }
            i++;
        }

        return 0;
        //方法3:
        int i=-1;
        while (str[++i]!='')
        {
            if (str[i]==c)
            {
                return 1
    ;
            }
        }

        //方法4:
        while (str[++i]!=''&&str[i]!=c);

         //return str[i] == ‘’?0:1;
        return str[i]!=‘';
    }
  • 相关阅读:
    vue中使用 canvas给页面添加水印
    c++ get keyboard event
    sublime text c++ makefile
    dddd
    songwenxin
    wechat
    ddd
    log
    v3
    xiaoxiaole
  • 原文地址:https://www.cnblogs.com/Alling/p/3971402.html
Copyright © 2011-2022 走看看