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

            導航

            留言簿(1)

            隨筆分類

            友情鏈接

            搜索

            最新隨筆

            最新評論

            閱讀排行榜

            久久线看观看精品香蕉国产| 久久AⅤ人妻少妇嫩草影院| 久久免费线看线看| 欧美va久久久噜噜噜久久| 伊人久久一区二区三区无码| 久久九色综合九色99伊人| 久久天堂电影网| 狠狠干狠狠久久| 久久国产免费观看精品| 亚洲综合久久综合激情久久| MM131亚洲国产美女久久| 久久久久久a亚洲欧洲aⅴ| 国产精品视频久久| 久久综合欧美成人| 国产综合成人久久大片91| 久久久久亚洲AV无码去区首| 国产精品成人久久久久久久| 99久久亚洲综合精品网站| 99久久免费国产精品| 欧美日韩中文字幕久久久不卡| 久久久久久国产a免费观看不卡| 青青草原1769久久免费播放| 中文精品久久久久国产网址| 免费观看久久精彩视频| 国产精品一区二区久久精品无码 | 青青热久久国产久精品| 欧美无乱码久久久免费午夜一区二区三区中文字幕 | 久久人人爽人人爽人人片AV麻豆 | 97久久久精品综合88久久| 久久婷婷国产麻豆91天堂| 久久久久久亚洲精品无码| 影音先锋女人AV鲁色资源网久久 | 亚洲一级Av无码毛片久久精品| 国产精品久久久久蜜芽| 久久久久亚洲精品天堂| 国产一区二区精品久久凹凸| 久久精品无码一区二区WWW| 久久精品国产亚洲AV无码偷窥| 狠狠色伊人久久精品综合网| 麻豆久久久9性大片| 一本久久a久久精品综合夜夜|