文章标题

来源:互联网 发布:js清除div内容 编辑:程序博客网 时间:2024/04/30 03:49

c/字符串,字符转数字,数字转字符(转)

(2011-03-19 11:56:48)
转载
var tag=it;vartag_code='d1c529b6f060ead3bddd595b3a52746b'; var rquotebligid=4c8a2a870100qgq7;varworldcup='0'; var $worldcupball='0'; 标签:

it

分类: 转载

在C/C++语言中没有专门的字符串变量,通常用字符数组来存放字符串。字符串是以“\0”作为结束符。C/C++提供了丰富的字符串处理函数,下面列出了几个最常用的函数。

  ●字符串输出函数puts。

  ●字符串输出函数gets。

  ●字符串连接函数strcat。

  ●字符串复制函数strcpy。

  ●测字符串长度函数strlen。

字符串是面试的重点考查部分的相关知识,通过考查字符串的相关知识可以考察程序员的编程规范以及编程习惯。并且其中包括了许多知识点,例如内存越界、指针与数组操作等。许多公司在面试时会要求应聘者写一段复制字符串或字符串子串操作的程序。本章列举了一些与字符串相关的面试题,有些题目要求较高的编程技巧。


6.1  数字与字符串的转化

应聘时经常出现数字与字符串之间转化的问题,面试官通过这类题目来考察应聘者能力,例如是否熟悉常用的库函数,是否了解ASCII码以及是否了解字符串的存储格式等。


6.1.1  数字转化为字符串

面试例题1:使用库函数将数字转换为字符串。

考点:C库函数中数字转换为字符串的使用。

出现频率:★★★

解析

C语言提供了几个标准库函数,可以将任意类型(整型、长整型、浮点型等)的数字转换为字符串,下面列举了各函数的方法及其说明。

  ●itoa():将整型值转换为字符串。

  ●ltoa():将长整型值转换为字符串。

  ●ultoa():将无符号长整型值转换为字符串。

  ●gcvt():将浮点型数转换为字符串,取四舍五入。

  ●ecvt():将双精度浮点型值转换为字符串,转换结果中不包含十进制小数点。

  ●fcvt():指定位数为转换精度,其余同ecvt()。

还可以使用sprintf系列函数把数字转换成字符串,其比itoa()系列函数运行速度慢。下列程序演示了如何使用itoa()函数和gcvt()函数:

   # include<stdio.h>

   # include<stdlib.h>

  

   int main()

   {

      intnum_int = 435;

      doublenum_double = 435.10f;

      charstr_int[30];

      charstr_double[30];

10  

11      itoa(num_int,str_int, 10);  //把整数num_int转成字符串str_int

12      gcvt(num_double,8, str_double); //把浮点数num_double转成字符串str_double

13  

14      printf(“str_int:%s\n”, str_int);

15      printf(“str_double:%s\n”, str_double);

16  

17      return0;

18  }

程序输出结果:

   str_int:435

   str_double:435.10001

  ●代码第11行中的参数10表示按十进制类型进行转换,转换后的结果是“435”,如果按二进制类型进行转换,则结果为“1101110011”。

  ●代码第12行中的参数8表示精确位数,这里得到的结果是“435.10001”。

答案

可以使用atoi系列函数把数字转换成字符串。

面试例题2:不使用库函数将整数转换为字符串。

考点:数字转换为字符串,理解相关ASCII码。

出现频率:★★★★

解析

如果不使用atoi或sprintf等库函数,可以通过把整数的各位上的数字加“0”转换成char类型并存到字符数组中。但是要注意,需要采用字符串逆序的方法。如以下程序所示:

   #include<iostream>

   usingnamespace std;

  

   voidint2str(int n, char *str)

   {

      charbuf[10] = “”;

      inti = 0;

      intlen = 0;

      inttemp = n < 0 ? -n: n;  //temp为n的绝对值

10  

11      if(str == NULL)

12      {

13          return;

14      }

15      while(temp)

16      {

17          buf[i++]= (temp % 10) + ‘0’;  //把temp的每一位上的数存入buf

18          temp= temp / 10;

19      }

20  

21      len= n < 0 ? ++i: i; //如果n是负数,则多需要一位来存储负号

22  

    str[i]=0;           //末尾是结束符0

23      while(1)

24      {

25          i–;

26          if(buf[len-i-1] ==0)

27          {

28              break;

29          }

30          str[i]= buf[len-i-1];  //把buf数组里的字符拷到字符串

31      }

32      if(i == 0 )

33      {

34  

        str[i]=‘-‘;         //如果是负数,添加一个负号

35      }

36  }

37  

38  int main()

39  {

40      intnNum;

41      charp[10];

42  

43      cout<< “Please input an integer:”;

44      cin>> nNum;

45      cout<< “output: ” ;

46      int2str(nNum,p);       //整型转换成字符串

47      cout<<p << endl;

48  

49      return0;

50  }

程序中的int2str函数完成了int类型到字符串类型的转换。在代码第46行对int2str函数做了测试。程序的执行结果如下所示:

Please input an integer: 1234

Output: 1234

如果输入的是个负数,程序执行结果如下所示:

Please input an integer: -1234

Output: -1234

接下来对int2str函数的实现进行分析。

  ●代码第9行,把参数n的绝对值赋给temp,以后在计算各个位的整数时用temp,这样保证在负数情况下取余不会出现问题。

  ●代码第11~第14行判断str的有效性,str不为NULL。

  ●代码第15~第19行的while循环中,将n的各个位存放到局部数组buf中,存放的顺序与整数顺序相反。例如n为整数123 456,while循环结束后buf应为“654 321”。

  ●代码第21行计算转换后字符串的长度len,如果是负数,长度应该再加1。

  ●代码第22~第31行把数组buf中的非0元素逆向复制到参数str指向的内存中,如果n是负数,则str指向的第一个内存存放负号。


6.1.2  字符串转化为数字

面试例题3:使用库函数将字符串转换为数字。

考点:C库函数中字符串转换为数字的使用。

出现频率:★★★★

解析

与上节数字转换为字符串类似,C/C++语言提供了几个标准库函数,可以将字符串转换为任意类型(整型、长整型、浮点型等)。以下列举了各函数的方法及其说明。

  ●atof():将字符串转换为双精度浮点型值。

  ●atoi():将字符串转换为整型值。

  ●atol():将字符串转换为长整型值。

  ●strtod():将字符串转换为双精度浮点型值,并报告不能被转换的所有剩余数字。

  ●strtol():将字符串转换为长整值,并报告不能被转换的所有剩余数字。

  ●strtoul():将字符串转换为无符号长整型值,并报告不能被转换的所有剩余数字。

以下程序演示如何使用atoi ()函数和atof ()函数。

   # include<stdio.h>

   # include<stdlib.h>

  

   int main()

   {

      intnum_int;

      doublenum_double;

      charstr_int[30] =“435”;        //将要被转换为整型的字符串

      charstr_double[30] = “436.55”;  //将要被转换为浮点型的字符串

10  

11  

    num_int=atoi(str_int);         //转换为整型值

12      num_double= atof(str_double);  //转换为浮点型值

13  

14      printf(“num_int:%d\n”, num_int);

15      printf(“num_double:%lf\n”, num_double);

16  

17      return0;

18  }

输出结果:

num_int: 435

num_double: 436.550000

面试例题4:不使用库函数将字符串转换为数字。

考点:字符串转换为数字时,对相关ASCII码的理解。

出现频率:★★★★

解析

程序代码如下:

   #include<iostream>

   usingnamespace std;

  

   intstr2int(const char *str)

   {

      inttemp = 0;

      constchar *ptr = str;  //ptr保存str字符串开头

  

      if(*str == ‘-’ || *str == ‘+’)  //如果第一个字符是正负号,

10                          //则移到下一个字符

11          str++;

12      }

13      while(*str!= 0)

14      {

15          if((*str < ‘0’) || (*str >‘9’))  //如果当前字符不是数字

16                               //则退出循环

17              break;

18          }

19          temp= temp * 10 + (*str - ‘0’); //如果当前字符是数字则计算数值

20          str++;     //移到下一个字符

21        

22      if(*ptr ==‘-‘)    //如果字符串是以“-”开头,则转换成其相反数

23      {

24          temp= -temp;

25      }

26  

27      returntemp;

28  }

29  

30  int main()

31  {

32      intn = 0;   

33      charp[10] = “”;

34  

35      cin.getline(p,20);   //从终端获取一个字符串

36  

    n=str2int(p);     //把字符串转换成整型数

37      

38      cout<< n <<endl;

39  

40      return0;

41  }

程序执行结果:

输入:1234

输出:1234

输入:-1234

输出:-1234

输入:+1234

输出:1234

程序中的str2int函数作用是将字符串转换成整数。这个函数的转换过程与例题2中的int2str函数相比更加简单,它只需要做一次while循环(代码第13行)就能把数值大小计算出来,如果结果是负数,就加一个负号。

 

 

 

 

 

C++字符串,数字相互转换

 

一.将CString转为CTime的几种方法

CString   timestr  =   “2000年04月05日”; 
  int   a,b,c  ;  
 sscanf(timestr.GetBuffer(timestr.GetLength()),”%d年%d月%d日”,&a,&b,&c); 
  CTime  time(a,b,c,0,0,0);    


——–or - ———————

 CString   s(“2001-8-29  19:06:23”);  
  int   nYear,  nMonth,   nDate,   nHour,  nMin,   nSec; 
  sscanf(s,   “%d-%d-%d  %d:%d:%d”,  &nYear,   &nMonth,  &nDate,  &nHour,   &nMin,  &nSec);  
  CTime   t(nYear,  nMonth,   nDate,  nHour,   nMin,  nSec);

—- or ————————
CString   timestr   “2000年04月05日”;  
  int   year,month,day; 
  BYTE   tt[5]; 
  //get   year 
  memset(tt,   0,  sizeof(tt));  
  tt[0]   =  timestr[0];  
  tt[1]   =  timestr[1];  
  tt[2]   =  timestr[2];  
  tt[3]   =  timestr[3];  
  year=   atoi((char  *)tt);  
   
  //get   month 
  memset(tt,   0,  sizeof(tt));  
  tt[0]   =  timestr[6];  
  tt[1]   =  timestr[7];  
  month   =  atoi((char   *)tt);  
   
  //get   day 
  memset(tt,   0,  sizeof(tt));  
  tt[0]   =  timestr[10];  
  tt[1]   =  timestr[11];  
   
  CTime  time(year,month,day,0,0,0);

从上面来看,很明显使用sscanf()函数的优势.

 

二.将CTIme转换为CString的方法:

CTime  tmSCan =CTime::GetCurrentTime();

CString szTime = tmScan.Format(“’%Y-%m-%d%H:%M:%S’”);

这样得到的日期时间字符串就是以”2006-11-2723:30:59”的格式.这是不是很方便呢?

 //取得CTime中的日期
 CString cstrDate =tmScan.Format(“%Y-%m-%d”);

 //取得CTime中的时间
 CString cstrTime =tmScan.Format(“%H:%M-%S”);

         sprintf还有个不错的表妹:strftime,专门用于格式化时间字符串的,用法跟她表哥很像,也是一大堆格式控制符,只是毕竟小姑娘家心细,她还要调用者指定缓冲区的最大长度,可能是为了在出现问题时可以推卸责任吧。这里举个例子:

 

 更多更好的sprintf()函数说明参考:《spirntf,你知道多少?》

http://blog.csdn.net/steedhorse/archive/2005/03/25/330206.aspx

time_t t = time(0);

     //产生“YYYY-MM-DDhh:mm:ss”格式的字符串。

char s[32];

strftime(s, sizeof(s), “%Y-%m-%d %H:%M:%S”,localtime(&t));

sprintfMFC中也能找到他的知音:CString::FormatstrftimeMFC中自然也有她的同道:CTime::Format,这一对由于从面向对象哪里得到了赞助,用以写出的代码更觉优雅。

三,字符串转换为数值类型

将字符串”20.0E6”转换为数字

1,sscanf(“20.0e5”,”%d”,&x);

2,atof(“20.0E6”);

许多人用atoi(), atof() 和这个“家族”中的其它函数. 它们方便应用,但是有一个重要的缺点:
在转换失败和转换字符串”0”时都返回0, 这样使得一致性错误检查变得几乎不可能。 为了完整性我们给出了小段代码:

 

代码:
——————————————————————————–
   const char* str_int =“777”;
   const char* str_float =“333.3”;
   int i = atoi(str_int);
   float f =atof(str_float);
——————————————————————————–


一个更好的办法:

更有一点复杂, 更遗一致的办法是利用sscanf()

代码:
——————————————————————————–
   const char* str_int =“777”;
   const char* str_float =“333.3”;
   int i;
   float f;
   if(EOF == sscanf(str_int,“%d”, &i)){
     //错误
   }
   if(EOF == sscanf(str_float,“%f”, &f)){
     //错误
   }
——————————————————————————–

Since sscanf() takes a const char* parameter, you can directlyuse a CString with it:
因为sscanf()用const char* 作为参数, 所以你可以直接用CString作参数:

代码:
——————————————————————————–
   CString str_int(“777”);
   if(EOF == sscanf(str_int,“%d”, &i)){
     //error
   }
——————————————————————————–

小心格式描述符(如本例中的”%d”)。sscanf()没有办法检查格式描述符与传递变量的类型匹配与否。如果不匹配你将得到不可预期的结果。同样注意sscanf()可以一次从字符串中提取一个或多个数值。 详细信息请查阅MSDN。

 

C++ 方法


如下的例子展示了利用标准C++类的来完成这个任务的模板函数

代码:
——————————————————————————–

#include <string>
#include <sstream>
#include <iostream>

template <class T>
bool from_string(T &t,
                const std::string &s,
                std::ios_base &(*f)(std::ios_base&))
{
   std::istringstreamiss(s);
   return!(iss>>f>>t).fail();
}

int main()
{
   int i;
   float f;
   //from_string()的第三个参数应为如下中的一个
   // one of std::hex, std::dec 或std::oct
  if(from_string<int>(i,std::string(“ff”), std::hex)){
     std::cout<<i<<std::endl;
   }
   else{
     std::cout<<”from_stringfailed”<<std::endl;
   }
  if(from_string<float>(f,
                              std::string(“123.456”),
                              std::dec))
   {
     std::cout<<f<<std::endl;
   }
   else{
     std::cout<<”from_stringfailed”<<std::endl;
   }
   return 0;
}

 

四, int char * float andCString Covernt

1。 int<->CString

1) int ->CString

int n = 1;

CString str;

str.Format(“%d”,n);

2) CString->int

CString str = “1”;

int n = atoi(str.GetBuffer(0));

2. char* 与CString

1)char*->CString

char sz[128];

CString str;

str.Format(“%s”,sz);

2) CString -> char*

CString str;

//int nLength = str.GetLength();

char* sz = str.GetBuffer(0);

3.float<->CString

1)float->CString

float f = 0.0;

CString str;

str.Format(“%f”,f);

2) CString->float

CString str = “0.0”;

float f = atof(str.GetBuffer(0));

 










3






0



        </div>        <div class="clearit"></div>    </div>    <div class="articalInfo">        <!-- 分享到微博 {$t_blog} -->        <div class="IL">            阅读<span id="r_4c8a2a870100qgq7" class="SG_txtb">(12534)</span><em class="SG_txtb">┊</em>             <a href="#commonComment">评论</a> <span id="c_4c8a2a870100qgq7" class="SG_txtb">(0)</span><em class="SG_txtb">┊</em>              <a href="javascript:;" onclick="$articleManage('4c8a2a870100qgq7',5);return false;">收藏</a><span id="f_4c8a2a870100qgq7" class="SG_txtb">(0)</span>            <em class="SG_txtb">┊</em><a href="#" id="quote_set_sign" onclick="return false ;">转载</a><a href="#" id="z_4c8a2a870100qgq7" onclick="return false ;" class="zznum">(19)</a>                <span id="fn_c/字符串,字符转数字,数字转字符(转)" class="SG_txtb"></span><em class="SG_txtb">┊</em>            <a onclick="return false;" href="javascript:;"><cite id="d1_digg_4c8a2a870100qgq7">喜欢</cite></a><a id="d1_digg_down_4c8a2a870100qgq7" href="javascript:;"><b>▼</b></a>                                <em class="SG_txtb">┊</em><a href="http://blog.sina.com.cn/main_v5/ria/print.html?blog_id=blog_4c8a2a870100qgq7" target="_blank">打印</a><em class="SG_txtb">┊</em><a id="q_4c8a2a870100qgq7" onclick="report('4c8a2a870100qgq7');return false;" href="#">举报</a>                                        </div>        <div class="IR">            <table>                <tbody><tr>                                        <th class="SG_txtb" scope="row">已投稿到:</th>                    <td>                        <div class="IR_list">                            <span><img class="SG_icon SG_icon36" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" width="15" height="15" title="排行榜" align="absmiddle"> <a href="http://blog.sina.com.cn/lm/114/113/day.html" class="SG_linkb" target="_blank">排行榜</a></span>                          </div>                    </td>                                    </tr>                                </tbody></table>        </div>    </div>    <div class="clearit"></div>    <div class="blogzz_zzlist borderc" id="blog_quote" style="display:none"><h3><a href="#" onclick="return false" title="关闭" id="ql_close4c8a2a870100qgq7" class="blogzz_closepic SG_floatR"></a>转载列表:</h3>                <ul class="ul_zzlist" id="ql_content4c8a2a870100qgq7">                </ul>             <ul style="display:none"><li id="ql_tip4c8a2a870100qgq7"></li></ul>                <div class="SG_clearB"></div>                <div class="blogzz_btn">                    <a id="btnArticleQuote4c8a2a870100qgq7" href="#" onclick="scope.article_quote &amp;&amp; scope.article_quote.check('4c8a2a870100qgq7');return false;" class="SG_aBtn SG_aBtn_ico SG_turn"><cite><img class="SG_icon SG_icon111" id="quoteList_quote4c8a2a870100qgq7" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" width="15" height="15" align="absmiddle">转载</cite></a>                   <p id="quoteDescription4c8a2a870100qgq7" class="SG_turntxt" style="display: none;">转载是分享博文的一种常用方式...</p>                </div>              <div id="ql_page4c8a2a870100qgq7" class="blogzz_paged"></div>               <div class="clearit"></div></div>    <div class="articalfrontback SG_j_linedot1 clearfix" id="new_nextprev_4c8a2a870100qgq7">                        <div><span class="SG_txtb">前一篇:</span><a href="http://blog.sina.com.cn/s/blog_4c8a2a870100q21d.html">[转载]寒假后一半</a></div>                                    <div><span class="SG_txtb">后一篇:</span><a href="http://blog.sina.com.cn/s/blog_4c8a2a870100qgs9.html">转:string&nbsp;to&nbsp;char*的转换</a></div>                </div>    <div class="clearit"></div>    <div id="loginFollow"></div>            <div class="allComm">        <div class="allCommTit">            <div class="SG_floatL">                <strong>评论</strong>                <span id="commAd_1" style="display: inline-block;">                    <span style="margin-left:15px; width:220px; display:inline-block;"><a target="_blank" href="http://blog.sina.com.cn/lm/8/2009/0325/105340.html">重要提示:警惕虚假中奖信息</a></span>                </span>            </div>            <div class="SG_floatR"><a class="CP_a_fuc" href="#post">[<cite>发评论</cite>]</a></div>        </div>        <ul id="article_comment_list" class="SG_cmp_revert"><li><div class="noCommdate"><span class="SG_txtb">做第一个评论者吧! <img class="SG_icon SG_icon134" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" width="18" height="18" title="" align="absmiddle"><a href="#post">抢沙发&gt;&gt;</a></span></div></li></ul>        <div class="clearit"></div>        <div class="myCommPages SG_j_linedot1">            <div class="SG_page" id="commentPaging" style="display:none;">                <ul class="SG_pages">                </ul>            </div>            <div class="clearit"></div>        </div>        <a name="post"></a>        <div class="writeComm">            <div class="allCommTit">                <div class="SG_floatL">                    <strong>发评论</strong>                    <span></span>                </div>                <div class="SG_floatR"></div>            </div>            <div class="wrCommTit">                <div class="SG_floatL" id="commentNick" style="display:none;"></div>            </div>            <div class="formTextarea">                <div style="float:left;" id="commonComment">                <iframe id="postCommentIframe" frameborder="0" style="border:1px solid #C7C7C7;    height:158px;width:448px;maring-top:1px;background-color:white;" src="http://blog.sina.com.cn/main_v5/ria/blank2.html"></iframe>                <textarea id="commentArea" tabindex="1" style="display:none;"></textarea>                </div>                <div id="mobileComment" style="float:left;display:none;">                    <textarea id="mbCommentTa" style="width:438px;height:150px;border:1px solid #C7C7C7;line-height:18px;padding:5px;"></textarea>                </div>                <div class="faceblk" id="faceWrap">                    <div id="smilesSortShow" class="faceline1">                    <div class="facestyle" id="recomm_1490236093963"><a href="#" key="302"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/302-25.gif" alt="小新小浪" title="小新小浪"></a><a href="#" key="308"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/308-25.gif" alt="炮炮兵" title="炮炮兵"></a><a href="#" key="315"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/315-25.gif" alt="张富贵" title="张富贵"></a><a href="#" key="316"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/316-25.gif" alt="旺狗" title="旺狗"></a><a href="#" key="331"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/331-25.gif" alt="悠嘻猴" title="悠嘻猴"></a><a href="#" key="351"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/351-25.gif" alt="酷巴熊" title="酷巴熊"></a></div><span class="SG_more"><a href="#">更多&gt;&gt;</a></span><div class="clearit"></div></div>                    <ul id="smilesRecommended" class="faceline01"><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0321EN00SIGT.gif" alt="就不买你" title="就不买你" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0320EN00SIGT.gif" alt="股市" title="股市" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0319EN00SIGT.gif" alt="发霉" title="发霉" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0318EN00SIGT.gif" alt="陈水边" title="陈水边" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0317EN00SIGT.gif" alt="裁员" title="裁员" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0316EN00SIGT.gif" alt="音乐" title="音乐" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0315EN00SIGT.gif" alt="贴你" title="贴你" height="50" width="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0314EN00SIGT.gif" alt="抢车位" title="抢车位" height="50" width="50"></a></li></ul>                </div>                <div class="clearit"></div>            </div>            <div class="formLogin">                <div class="SG_floatL">                 <p id="commentlogin" style="display: block;"><span>登录名:</span><input type="text" style="width: 115px;" id="login_name" tabindex="2">   <span>密码:</span><input type="password" style="width: 115px;" id="login_pass" tabindex="3">   <a href="http://login.sina.com.cn/getpass.html" target="_blank">找回密码</a>   <a href="http://login.sina.com.cn/signup/signup.php?entry=blog&amp;src=blogicp&amp;srcuid=1284123271" target="_blank">注册</a> <input type="checkbox" id="login_remember"><label for="login_remember" style="display:inline-block;" title="建议在网吧/公用电脑上取消该选项">记住登录状态</label></p><p id="commentloginM" style="display:none;"><span>昵&nbsp;&nbsp;&nbsp;称:</span><input type="text" style="width: 115px;" id="comment_anonyous" value="新浪网友" tabindex="2" disabled=""></p><p id="quote_comment_p"><input type="checkbox" id="bb"> <label for="bb"><img height="18" align="absmiddle" width="18" title="" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" class="SG_icon SG_icon110">分享到微博 <img height="15" align="absmiddle" width="15" title="新" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" class="SG_icon SG_icon11"></label>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="cbCommentQuote"><label for="cbCommentQuote">评论并转载此博文</label><img class="SG_icon SG_icon11" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" width="15" height="15" title="新" align="absmiddle"></p>                <p id="geetest-box"><div id="geetest_1490236101775" class="gt_holder gt_float" style="touch-action: none;"><div class="gt_input"><input class="geetest_challenge" type="hidden" name="geetest_challenge"><input class="geetest_validate" type="hidden" name="geetest_validate"><input class="geetest_seccode" type="hidden" name="geetest_seccode"></div><div class="gt_slider"><div class="gt_guide_tip gt_show">按住左边滑块,拖动完成上方拼图</div><div class="gt_slider_knob gt_show" style="left: 0px;"></div><div class="gt_curtain_tip gt_hide">点击上图按钮并沿道路拖动到终点处</div><div class="gt_curtain_knob gt_hide">移动到此开始验证</div><div class="gt_ajax_tip gt_ready"></div></div></div></p>                </div>                <span style="display: none; color: rgb(153, 153, 153); margin-left: 10px;" id="login_remember_caution"></span>                                        <div class="SG_floatR" id="anonymity_cont" style="display: none;"><input type="checkbox" id="anonymity"><label for="anonymity">匿名评论</label></div>                                </div>            <div class="formBtn">                <a href="javascript:;" onclick="return false;" class="SG_aBtn" tabindex="5"><cite id="postcommentid">发评论</cite></a>                <p class="SG_txtc">以上网友发言只代表其个人观点,不代表新浪网的观点或立场。</p>            </div>        </div>    </div>            <div class="clearit"></div>            <div class="articalfrontback articalfrontback2 clearfix">                      <div class="SG_floatL"><span class="SG_txtb">&lt;&nbsp;前一篇</span><a href="http://blog.sina.com.cn/s/blog_4c8a2a870100q21d.html">[转载]寒假后一半</a></div>                                  <div class="SG_floatR"><span class="SG_txtb">后一篇&nbsp;&gt;</span><a href="http://blog.sina.com.cn/s/blog_4c8a2a870100qgs9.html">转:string&nbsp;to&nbsp;char*的转换</a></div>                </div>    <div class="clearit"></div></div>
0 0
原创粉丝点击