• <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)

            隨筆分類

            友情鏈接

            搜索

            最新隨筆

            最新評論

            閱讀排行榜

            天天爽天天爽天天片a久久网| 久久天天日天天操综合伊人av| 久久国产精品波多野结衣AV| 久久久精品日本一区二区三区 | 久久久久久久尹人综合网亚洲| 精品欧美一区二区三区久久久| 99久久国产免费福利| 久久久亚洲欧洲日产国码aⅴ| 久久丫忘忧草产品| 久久久无码人妻精品无码| 国产精品免费福利久久| 亚洲国产精品久久久久婷婷软件| 久久精品国产91久久麻豆自制| 日本福利片国产午夜久久| 久久香蕉国产线看观看猫咪?v| 亚洲国产精品狼友中文久久久| 久久精品国产亚洲AV不卡| 人妻无码精品久久亚瑟影视| 久久66热人妻偷产精品9| 四虎久久影院| 99热都是精品久久久久久| 久久久久久精品成人免费图片| 99久久久精品| 大伊人青草狠狠久久| 欧美午夜A∨大片久久| 久久久久久久99精品免费观看| 无码任你躁久久久久久老妇App| 亚洲狠狠综合久久| 成人久久综合网| 久久九九亚洲精品| 久久99国产精品二区不卡| 无码久久精品国产亚洲Av影片| 久久91精品国产91| 久久亚洲美女精品国产精品| 午夜精品久久久久久99热| 久久精品一区二区三区AV| 日韩精品无码久久久久久| 国产一级做a爰片久久毛片| 99久久国产主播综合精品| 国产精品VIDEOSSEX久久发布| 热久久国产欧美一区二区精品|