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

            Jiwu Bu

              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              32 隨筆 :: 0 文章 :: 25 評(píng)論 :: 0 Trackbacks
            轉(zhuǎn)載鏈接:http://blog.chinaunix.net/u2/76292/showart_1845022.html

             1 #include <stdlib.h>
             2 #include <stdio.h>
             3 #include <ctype.h>
             4 
             5 long my_atol(const char *nptr)
             6 {
             7     int c; /* current char */
             8     long total; /* current total */
             9     int sign; /* if '-', then negative, otherwise positive */
            10 
            11     /* skip whitespace */
            12     while ( isspace((int)(unsigned char)*nptr) )
            13     {
            14         ++nptr;
            15     }
            16     
            17     c = (int)(unsigned char)*nptr++;
            18     sign = c; /* save sign indication */
            19     if (c == '-' || c == '+')
            20     {
            21         c = (int)(unsigned char)*nptr++/* skip sign */
            22     }
            23     
            24     total = 0;
            25 
            26     while (isdigit(c)) 
            27     {
            28         total = 10 * total + (c - '0'); /* accumulate digit */
            29         c = (int)(unsigned char)*nptr++/* get next char */
            30     }
            31 
            32     if (sign == '-')
            33     {
            34        return -total;
            35     }
            36     else
            37     {
            38         return total; /* return result, negated if necessary */
            39     }
            40 }
            41 
            42 int  main(int argc, char* argv[])
            43 {
            44     if( argc < 2 )
            45     {
            46         return -1;
            47     }
            48 
            49     int i = my_atol(argv[1]);
            50     printf("[%s]====>[%d]\n", argv[1], i);
            51    
            52     int j = atoi(argv[1]);
            53     printf("[%s]====>[%d]\n", argv[1], j);
            54 
            55     return 0;
            56 }
            57 
            http://m.shnenglu.com/Files/bujiwu/atoi.rar

            posted on 2010-01-15 17:52 bujiwu 閱讀(1436) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 算法與數(shù)據(jù)結(jié)構(gòu)
            欧美精品一本久久男人的天堂| 色综合久久久久无码专区| 精品午夜久久福利大片| 久久精品这里热有精品| 久久精品国产99国产精品| 精品久久久无码人妻中文字幕| 久久精品国产亚洲AV嫖农村妇女| 国产三级观看久久| 中文字幕人妻色偷偷久久| 狠狠精品干练久久久无码中文字幕| 精品久久久中文字幕人妻 | 久久久久亚洲精品天堂| 国产精品伊人久久伊人电影| 久久精品综合网| 久久av免费天堂小草播放| 亚洲精品国产字幕久久不卡 | 久久精品国产久精国产果冻传媒| 久久久91精品国产一区二区三区| 久久久精品国产免大香伊| 久久久久久亚洲精品无码| 久久99国产精品久久| 久久久久国产精品熟女影院| 少妇久久久久久被弄到高潮| 国产免费福利体检区久久| 青草影院天堂男人久久| 丰满少妇高潮惨叫久久久| 久久久久免费看成人影片| 97精品国产97久久久久久免费| 亚洲国产精品综合久久一线| 久久精品国产一区二区电影| 国内精品免费久久影院| 狠狠色综合网站久久久久久久| 久久亚洲国产精品一区二区| 久久精品国产亚洲麻豆| 久久综合九色综合欧美狠狠| 久久免费精品视频| 久久本道久久综合伊人| 久久久人妻精品无码一区 | 精品久久久无码中文字幕| 精品久久久久久国产牛牛app | 亚洲综合熟女久久久30p|