• <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
            重要的是這個(gè)磨練過(guò)程,而不是結(jié)果,要的是你粗壯的腿,而不是你身上背的那袋鹽巴

             

            求得含有最多連續(xù)特定字符個(gè)數(shù)的字符串

            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) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 算法+數(shù)據(jù)結(jié)構(gòu)

            導(dǎo)航

            留言簿(1)

            隨筆分類

            友情鏈接

            搜索

            最新隨筆

            最新評(píng)論

            閱讀排行榜

            久久精品国产亚洲AV不卡| 亚洲人AV永久一区二区三区久久| 无码人妻久久一区二区三区蜜桃| 人妻无码久久精品| 久久精品青青草原伊人| 久久久久人妻精品一区二区三区 | 久久成人小视频| 日产精品久久久久久久性色| 久久亚洲国产精品一区二区| 亚洲综合久久夜AV | 美女写真久久影院| 久久人做人爽一区二区三区| 久久综合中文字幕| 中文字幕日本人妻久久久免费| 久久精品国产91久久麻豆自制| 国产欧美久久久精品影院| 一本久久久久久久| 亚洲精品tv久久久久久久久| 久久av免费天堂小草播放| 精品久久久久久国产| 亚洲AV日韩精品久久久久| 久久国产精品波多野结衣AV| 久久国产乱子伦免费精品| 久久99久久99精品免视看动漫| 中文字幕无码久久精品青草| 亚洲欧美一区二区三区久久| 亚洲国产天堂久久久久久| 久久精品国产2020| 久久人人爽人人爽人人片AV东京热 | 亚洲精品国精品久久99热| segui久久国产精品| 亚洲乱码中文字幕久久孕妇黑人| 一本一道久久精品综合| 久久久久99精品成人片牛牛影视| 久久久久免费视频| AV无码久久久久不卡蜜桃| 色青青草原桃花久久综合| 青青草原综合久久大伊人精品| 伊人久久一区二区三区无码| 青青草原1769久久免费播放| 精品久久久久久中文字幕人妻最新|