<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>

            求最大連續遞增數字串

            時間:2020-11-23 18:54:38 筆試題目 我要投稿

            求最大連續遞增數字串

              int GetSubString(char *strSource, char *strResult) {

              int iTmp=0, iHead=0, iMax=0;

              for(int Index=0, iLen=0; strSource[Index]; Index++) {

              if(strSource[Index] >= ’0′ && strSource[Index] <= ’9′ &&

              strSource[Index-1] > ’0′ && strSource[Index] == strSource[Index-1]+1) {

              iLen++; // 連續數字的.長度增1

              } else { // 出現字符或不連續數字

              if(iLen > iMax) {

              iMax = iLen; iHead = iTmp;

              }

              // 該字符是數字,但數字不連續

              if(strSource[Index] >= ’0′ && strSource[Index] <= ’9′) {

              iTmp = Index;

              iLen = 1;

              }

              }

              }

              for(iTmp=0 ; iTmp < iMax; iTmp++) // 將原字符串中最長的連續數字串賦值給結果串

              strResult[iTmp] = strSource[iHead++];

              strResult[iTmp]=’\0′;

              return iMax; // 返回連續數字的最大長度

              }

              int main(int argc, char* argv[]) {

              char strSource[]=”ads3sl456789DF3456ld345AA”, char strResult[sizeof(strSource)];

              printf(“Len=%d, strResult=%s \nstrSource=%s\n”,

              GetSubString(strSource, strResult), strResult, strSource);

              }

            【求最大連續遞增數字串】相關文章:

            關于文字自動遞增的CAD教程12-04

            房屋租賃遞增合同范本2篇02-06

            報酬遞增思想的演進機理研究論文08-13

            連續觀察日記20010-28

            連續觀察日記格式08-23

            分析養老金空賬遞增的形成原因09-19

            韓國留學生正在以每年25%的速度遞增09-14

            連續觀察泡豆子日記01-13

            日語學習之連續副詞08-12

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看