久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      strstr函數(shù) strstr函數(shù)是什么意思

      在學(xué)習(xí)函數(shù)的時(shí)候,有很多函數(shù),雖然在平時(shí)我們能夠遇見可是有一些函數(shù),卻是我們不了解的,對(duì)于它的使用方式更是不甚了解,今天我們就來看一看strstr函數(shù)的具體使用方式是什么?

      strstr函數(shù) strstr函數(shù)是什么意思

      strstr函數(shù)——strstr函數(shù)是什么意思

      strstr(str1,str2)函數(shù)用于判斷字符串str2是否是str1的子串。如果是,則該函數(shù)返回str2在str1中首次出現(xiàn)的地址;否則,返回NULL。

      strstr(string,search [, bool $before_needle = false ])

      注釋:search若是數(shù)字,所搜索的將是該數(shù)字(作為ASCII碼)代表的字符。

      注釋:該函數(shù)是二進(jìn)制安全的。

      注釋:該函數(shù)對(duì)大小寫敏感。如需進(jìn)行大小寫不敏感的搜索,請(qǐng)使用stristr()。

      Strstr函數(shù)如何自己實(shí)現(xiàn)

      請(qǐng)用標(biāo)準(zhǔn)C語言實(shí)現(xiàn)下列標(biāo)準(zhǔn)庫函數(shù),設(shè)計(jì)中不得使用其他庫函數(shù)。char*strstr(char*str1,char*str2);在字符串str1中,尋找字串str2,若找到返回找到的位置,否則返回NULL。[cpp]viewplaincopy#include#includeusingnamespacestd;&

      請(qǐng)用標(biāo)準(zhǔn)C語言實(shí)現(xiàn)下列標(biāo)準(zhǔn)庫函數(shù),設(shè)計(jì)中不得使用其他庫函數(shù)。char*strstr(char*str1,char*str2);

      在字符串str1中,尋找字串str2,若找到返回找到的位置,否則返回NULL。

      [cpp]viewplaincopy

      #include

      #include

      usingnamespacestd;

      constchar*StrStr(constchar*str1,constchar*str2)

      {

      assert(NULL!=str1&;&;NULL!=str2);

      while(*str1!=’/0′)

      {

      constchar*p=str1;

      constchar*q=str2;

      constchar*res=NULL;

      if(*p==*q)

      {

      res=p;

      while(*p&;&;*q&;&;*p++==*q++)

      ;

      if(*q==’/0′)

      returnres;

      }

      str1++;

      }

      returnNULL;

      }

      intmain()

      {

      constchar*str1=”wangyang”;

      constchar*str2=”ang”;

      constchar*res=StrStr(str1,str2);

      if(res!=NULL)

      cout<

      else

      cout<<“NOT”<

      system(“pause”);

      }

      以上是strstr函數(shù)的自己實(shí)現(xiàn)的內(nèi)容,更多函數(shù)的內(nèi)容,歡迎關(guān)注優(yōu)詞網(wǎng)。最后也需要提醒各位的是,在使用函數(shù)的時(shí)候,一定要按照函數(shù)的正確方式和正確的步驟來操作,否則結(jié)果是很容易出錯(cuò)的。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)