• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            C++ Jounior

            once setback,once inspiration,once self-awareness
            重要的是這個磨練過程,而不是結果,要的是你粗壯的腿,而不是你身上背的那袋鹽巴

             

            求得含有最多連續特定字符個數的字符串

            int ?GetMaxCountofContinuousLetter( char ? * ?p, char ?searchChar)
            {
            ????
            int ?maxCount? = 0 ;
            ????
            int ?currentCount? = ? 0 ;
            ????
            while ( 1 )
            ????
            {
            ????????
            if ( * p? == ?searchChar)
            ????????
            {
            ????????????currentCount?
            = ? 0 ;
            ????????????
            while ( * p? && ? * p? == ?searchChar)
            ????????????
            {
            ????????????????currentCount?
            ++ ;
            ????????????????p
            ++ ;
            ????????????}

            ????????????
            if (maxCount? < ?currentCount)
            ????????????????maxCount?
            = ?currentCount;
            ????????}

            ????????
            if ( * p? == ? ' \0 ' )?
            ????????????
            break ;
            ????????
            else
            ????????????p
            ++ ;
            ????}

            ????
            return ?maxCount;
            }

            int ?main()?????
            {??
            ????
            char ? * p[ 3 ] =
            ????
            {
            ????????
            " String(1)8818882348888856788888888988888888880 " ,
            ????????
            " String(2)881888234888885678888888898888888880 " ,
            ????????
            " String(3)8818882348888856788888888988888888888888880 "
            ????}
            ;
            ????
            int ?location? = ? 0 ;
            ????
            char ?searchChar? = ? ' 8 ' ;
            ????
            int ?tempCount? = ? 0 ;
            ????
            int ?maxCount? = ? 0 ;
            ????
            for ( int ?i? = ? 0 ;i < sizeof (p) / sizeof ( * p);i ++ )
            ????
            {
            ????????tempCount?
            = ?GetMaxCountofContinuousLetter(p[i],searchChar);
            ????????
            if (?tempCount? > ?maxCount)
            ????????
            {
            ????????????maxCount?
            = ?tempCount;
            ????????????location?
            = ?i;
            ????????}

            ????}

            ????cout
            << " the?string?of?maxCount?is?:? " << p[location] << endl;
            ????cout
            << " the?count?of??the?continuous?letters?is?:? " << maxCount << endl;
            ????cin.
            get ();
            }

            posted on 2008-04-02 09:30 snowball 閱讀(315) 評論(0)  編輯 收藏 引用 所屬分類: 算法+數據結構

            導航

            留言簿(1)

            隨筆分類

            友情鏈接

            搜索

            最新隨筆

            最新評論

            閱讀排行榜

            中文精品久久久久人妻| 久久婷婷国产剧情内射白浆| 草草久久久无码国产专区| 国内精品伊人久久久久网站| 免费精品久久天干天干| 亚洲国产欧美国产综合久久| 国产成人久久777777| 色偷偷久久一区二区三区| 99久久精品国产综合一区| 人妻无码久久一区二区三区免费| 国产精品热久久毛片| 亚洲AV无一区二区三区久久 | 国内精品免费久久影院| 亚洲午夜无码久久久久| 热久久国产欧美一区二区精品| 久久婷婷五月综合国产尤物app| 人妻无码久久精品| 日本精品久久久久中文字幕8 | 伊人久久综在合线亚洲2019| 无码人妻久久一区二区三区| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 三上悠亚久久精品| 久久久精品人妻一区二区三区蜜桃 | 久久久久亚洲AV无码专区网站 | 精品久久久久久亚洲精品| 国色天香久久久久久久小说| 一本综合久久国产二区| 欧美久久综合九色综合| 久久伊人影视| 久久性生大片免费观看性| 久久se精品一区精品二区国产| 青青热久久综合网伊人| A级毛片无码久久精品免费| 香蕉久久一区二区不卡无毒影院 | 精品久久久久久久久中文字幕| 三级三级久久三级久久| 国产亚洲精久久久久久无码77777 国产亚洲精品久久久久秋霞 | 丰满少妇高潮惨叫久久久| 99久久国产综合精品麻豆| 欧美亚洲国产精品久久蜜芽| 久久国产亚洲精品麻豆|