• <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 閱讀(325) 評論(0)  編輯 收藏 引用 所屬分類: 算法+數據結構

            導航

            留言簿(1)

            隨筆分類

            友情鏈接

            搜索

            最新隨筆

            最新評論

            閱讀排行榜

            蜜臀久久99精品久久久久久小说| 成人精品一区二区久久久| 亚洲精品乱码久久久久久不卡| 久久综合久久综合亚洲| 日产精品99久久久久久| 99久久国产热无码精品免费久久久久| 久久久久国色AV免费看图片| 亚洲日韩欧美一区久久久久我| 一本一本久久aa综合精品| 九九久久精品国产| 国产成人精品久久二区二区| 欧美日韩精品久久久久| 国产L精品国产亚洲区久久| 亚洲午夜久久久久久噜噜噜| 国产一区二区精品久久岳| 久久久久人妻精品一区| 欧美久久一级内射wwwwww.| 亚洲一本综合久久| 国产精品久久久久久搜索| 亚洲中文字幕无码一久久区| 狠狠色伊人久久精品综合网 | 波多野结衣久久一区二区| 亚洲成人精品久久| 久久99国产精品一区二区| 精品国产99久久久久久麻豆| 亚洲欧美国产精品专区久久| 久久久久人妻一区精品| 精品久久人人爽天天玩人人妻| 日韩一区二区久久久久久| 国产精品久久精品| 欧美日韩中文字幕久久伊人| 久久被窝电影亚洲爽爽爽| 久久精品国产亚洲欧美| 久久最新精品国产| 国产成人精品久久| 久久九九免费高清视频| 久久久久久国产a免费观看不卡| 久久国产精品国语对白| 伊色综合久久之综合久久| 久久九九久精品国产免费直播| 97精品国产97久久久久久免费|