锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产韩国精品一区二区三区久久,99精品国产综合久久久久五月天,香蕉久久夜色精品升级完成http://www.shnenglu.com/Leon916/zh-cnWed, 07 May 2025 16:15:35 GMTWed, 07 May 2025 16:15:35 GMT60褰掑茍鎺掑簭http://www.shnenglu.com/Leon916/archive/2009/09/13/96034.htmlLeon916Leon916Sun, 13 Sep 2009 02:28:00 GMThttp://www.shnenglu.com/Leon916/archive/2009/09/13/96034.htmlhttp://www.shnenglu.com/Leon916/comments/96034.htmlhttp://www.shnenglu.com/Leon916/archive/2009/09/13/96034.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/96034.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/96034.html甯栧瓙錛屾槸鍏充簬褰掑茍鎺掑簭鐨勶紝鍙戠幇閿欒寰堥殣钄斤紙鍦ㄦ垜鐪嬫潵錛夛紝鍚庢潵緇忚繃璋冭瘯鍜岃窡韙墠鎵懼埌浜嗚繖涓敊璇傜粨鏋滄槸涓涓緢綆鍗曠殑閫昏緫闂錛岃嚜宸卞お絎ㄤ簡錛岃姳浜?銆?涓皬鏃躲傚搸錛岃繕鏄湅紼嬪簭鏃剁矖鏋濆ぇ鍙訛紒

Leon916 2009-09-13 10:28 鍙戣〃璇勮
]]>
STL婧愮爜闃呰1http://www.shnenglu.com/Leon916/archive/2009/09/11/95969.htmlLeon916Leon916Fri, 11 Sep 2009 14:04:00 GMThttp://www.shnenglu.com/Leon916/archive/2009/09/11/95969.htmlhttp://www.shnenglu.com/Leon916/comments/95969.htmlhttp://www.shnenglu.com/Leon916/archive/2009/09/11/95969.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/95969.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/95969.html       綆鍗曟葷粨涓涓嬶細 鐩墠鐪嬪埌鐨勬妧宸ф湁錛歵raite鎶鏈紝浠垮嚱鏁幫紙浠垮嚱鏁伴兘鏄畾涔変簡()鍑芥暟榪愮畻鎿嶄綔絎︾殑綾?/span>錛夈傚叧浜庝豢鍑芥暟鍙互鍙傜湅http://blog.csdn.net/kingofbirdzjy/archive/2007/12/10/1926653.aspx銆?

Leon916 2009-09-11 22:04 鍙戣〃璇勮
]]>
閲嶆柊寮濮?/title><link>http://www.shnenglu.com/Leon916/archive/2009/09/11/95945.html</link><dc:creator>Leon916</dc:creator><author>Leon916</author><pubDate>Fri, 11 Sep 2009 09:08:00 GMT</pubDate><guid>http://www.shnenglu.com/Leon916/archive/2009/09/11/95945.html</guid><wfw:comment>http://www.shnenglu.com/Leon916/comments/95945.html</wfw:comment><comments>http://www.shnenglu.com/Leon916/archive/2009/09/11/95945.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/Leon916/comments/commentRss/95945.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Leon916/services/trackbacks/95945.html</trackback:ping><description><![CDATA[       濂介暱鏃墮棿娌℃湁鍐欑▼搴忎簡錛屾暡浠g爜+璋冭瘯鑺變簡鎴?涓皬鏃舵椂闂達紝灝變負浜嗕竴閬撶壒綆鍗曢鐩紙acm3299錛夛紝浠ュ悗瑕佸澶氶敾鐐兼墠琛屻?br> 浠g爜濡備笅錛? <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">math.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">float</span><span style="COLOR: #000000"> E </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2.718281828</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">argv[])<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img id=Codehighlighter1_101_1004_Open_Image onclick="this.style.display='none'; Codehighlighter1_101_1004_Open_Text.style.display='none'; Codehighlighter1_101_1004_Closed_Image.style.display='inline'; Codehighlighter1_101_1004_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_101_1004_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_1004_Closed_Text.style.display='none'; Codehighlighter1_101_1004_Open_Image.style.display='inline'; Codehighlighter1_101_1004_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_101_1004_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_101_1004_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">float</span><span style="COLOR: #000000"> t, d, h, e, hh;<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> index;<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> temp;<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">( (scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%c</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">temp) </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000"> (temp </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">E</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">))<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img id=Codehighlighter1_204_991_Open_Image onclick="this.style.display='none'; Codehighlighter1_204_991_Open_Text.style.display='none'; Codehighlighter1_204_991_Closed_Image.style.display='inline'; Codehighlighter1_204_991_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_204_991_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_204_991_Closed_Text.style.display='none'; Codehighlighter1_204_991_Open_Image.style.display='inline'; Codehighlighter1_204_991_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_204_991_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_204_991_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        index </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">( </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000"> ; i </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img id=Codehighlighter1_251_524_Open_Image onclick="this.style.display='none'; Codehighlighter1_251_524_Open_Text.style.display='none'; Codehighlighter1_251_524_Closed_Image.style.display='inline'; Codehighlighter1_251_524_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_251_524_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_251_524_Closed_Text.style.display='none'; Codehighlighter1_251_524_Open_Image.style.display='inline'; Codehighlighter1_251_524_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_251_524_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_251_524_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">switch</span><span style="COLOR: #000000">(temp)<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img id=Codehighlighter1_272_498_Open_Image onclick="this.style.display='none'; Codehighlighter1_272_498_Open_Text.style.display='none'; Codehighlighter1_272_498_Closed_Image.style.display='inline'; Codehighlighter1_272_498_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_272_498_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_272_498_Closed_Text.style.display='none'; Codehighlighter1_272_498_Open_Image.style.display='inline'; Codehighlighter1_272_498_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>            </span><span id=Codehighlighter1_272_498_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_272_498_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">T</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                index </span><span style="COLOR: #000000">|=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0x1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%f</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">t);<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">D</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                index </span><span style="COLOR: #000000">|=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0x2</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%f</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">d);<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">H</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                index </span><span style="COLOR: #000000">|=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0x4</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%f</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">h);<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">default</span><span style="COLOR: #000000">:<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                i</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%c</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">temp);<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">switch</span><span style="COLOR: #000000">(index)<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img id=Codehighlighter1_544_942_Open_Image onclick="this.style.display='none'; Codehighlighter1_544_942_Open_Text.style.display='none'; Codehighlighter1_544_942_Closed_Image.style.display='inline'; Codehighlighter1_544_942_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_544_942_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_544_942_Closed_Text.style.display='none'; Codehighlighter1_544_942_Open_Image.style.display='inline'; Codehighlighter1_544_942_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_544_942_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_544_942_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            <br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">:  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> t d</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">41</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">            e </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">6.11</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> exp(</span><span style="COLOR: #000000">5417.7530</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(d</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">))));<br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            hh </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (</span><span style="COLOR: #000000">0.5555</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> (e </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">10.0</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            h </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> t </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> hh;<br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">6</span><span style="COLOR: #000000">:        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">d, h ----t</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">46</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">            e </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">6.11</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> exp(</span><span style="COLOR: #000000">5417.7530</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">((</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">(d</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">))));<br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            t </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> h </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0.5555</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> (e </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">10.0</span><span style="COLOR: #000000">); <br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">5</span><span style="COLOR: #000000">:            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">t h ---d</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">50</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">double</span><span style="COLOR: #000000"> e;<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            e </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (h</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">t)</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">0.5555</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">10.0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            d </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">((</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> (log(e</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">6.11</span><span style="COLOR: #000000">))</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">5417.753</span><span style="COLOR: #000000">) </span><span style="COLOR: #000000">-</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">273.16</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">T %.1f D %.1f H %.1f\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, t, d, h);<br></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <img src ="http://www.shnenglu.com/Leon916/aggbug/95945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Leon916/" target="_blank">Leon916</a> 2009-09-11 17:08 <a href="http://www.shnenglu.com/Leon916/archive/2009/09/11/95945.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>C璇█鏂囦歡璇誨啓http://www.shnenglu.com/Leon916/archive/2009/04/10/79456.htmlLeon916Leon916Fri, 10 Apr 2009 03:02:00 GMThttp://www.shnenglu.com/Leon916/archive/2009/04/10/79456.htmlhttp://www.shnenglu.com/Leon916/comments/79456.htmlhttp://www.shnenglu.com/Leon916/archive/2009/04/10/79456.html#Feedback1http://www.shnenglu.com/Leon916/comments/commentRss/79456.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/79456.html
int main(int argc, char *argv[])
{
    FILE 
*file;
    FILE 
*fw;
    
if( (file = fopen("main.cpp""r")) == NULL)
        
return -1;
    
if( (fw = fopen("text.txt""wt")) == NULL)
        
return -1;

    
char ch;
    
while( (ch=fgetc(file)) != EOF )
    {
        fputc(ch, fw);
        printf(
"%c", ch);
    }

    fclose(file);
    fclose(fw);
    
return 0;
}

    
//char ch[LEN] = {0};
    
//while( !feof(file) )
    
//{
    
//    fread(ch, sizeof(char), LEN-1, file);
    
//    printf("%s", ch);
    
//    fwrite(ch, sizeof(char), LEN-1, fw);
    
//    memset(ch, 0, sizeof(char)*LEN);
    
//}
榪欐槸鐢ㄩ氳繃璋冪敤c璇█鐨勫簱鏂囦歡鏉ュ疄鐜般?br>浠ヤ笅鏄敤C++鐨勪腑鐨剆tream鏉ュ疄鐜扮殑錛屼絾鏄湪澶勭悊涓枃鐨勬椂鍊欙紝浼氬嚭鐜頒竴浜涗貢鐮併?br>
//fstream fs;
//    fs.open(_T("鏂囨湰.txt"));
//
//    char arr[LEN] = {0};
//    wchar_t temp[2*LEN+1] = {0};
//    int length;
//    if(!fs)
//    {
//        cout << "Error" << endl;
//        return -1;
//    }
    
//while(!fs.eof())
    
//{
    
//    fs.read(arr, sizeof(arr)-1);
    
//    length = MultiByteToWideChar(CP_ACP, 0, arr, -1, NULL, NULL);
    
//    MultiByteToWideChar(CP_ACP, 0, arr, -1, temp, length);
    
//    wcout.imbue(locale("chs"));
    
//    wcout << temp;
    
//}
浣嗘槸閫氳繃char綾誨瀷榪涜璇誨啓鍗翠笉鍑虹幇涔辯爜錛屾劅瑙夊緢濂囨?br>
int main(int argc, char *argv[])
{
    fstream fs;
    fs.open(_T(
"鏂囨湰.txt"));

    fstream fw;
    fw.open(
"text.txt");
    
char arr[LEN] = {0};
    wchar_t temp[
2*LEN+1= {0};
    
int length;
    
if(!fs || !fw)
    {
        cout 
<< "Error" << endl;
        
return -1;
    }
    
while(!fs.eof())
    {
        fs.read(arr, 
sizeof(arr)-1);
        cout 
<< arr;
        fw.write(arr, 
sizeof(arr)-1);
        memset(arr, 
0sizeof(arr));

    }
    cout 
<< endl;
    fs.close();
    fw.close();
    
return 0;
}




Leon916 2009-04-10 11:02 鍙戣〃璇勮
]]>
涓涓狫ava鐨凚-Tree婧愪唬鐮?/title><link>http://www.shnenglu.com/Leon916/archive/2009/03/29/78271.html</link><dc:creator>Leon916</dc:creator><author>Leon916</author><pubDate>Sun, 29 Mar 2009 07:54:00 GMT</pubDate><guid>http://www.shnenglu.com/Leon916/archive/2009/03/29/78271.html</guid><wfw:comment>http://www.shnenglu.com/Leon916/comments/78271.html</wfw:comment><comments>http://www.shnenglu.com/Leon916/archive/2009/03/29/78271.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/Leon916/comments/commentRss/78271.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/Leon916/services/trackbacks/78271.html</trackback:ping><description><![CDATA[    榪欐槸鎴戝湪鐪嬩竴涓狫ava寮婧愯蔣浠剁殑鏃跺欙紝鍙戠幇涓涓漢鍐欑殑浠g爜錛岄噷闈㈡湁涓変釜鍑芥暟鍒扮幇鍦ㄨ繕娌℃湁鐪嬫噦錛屽厛鏀懼湪blog閲岄潰銆? <img src ="http://www.shnenglu.com/Leon916/aggbug/78271.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/Leon916/" target="_blank">Leon916</a> 2009-03-29 15:54 <a href="http://www.shnenglu.com/Leon916/archive/2009/03/29/78271.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鎻愰啋http://www.shnenglu.com/Leon916/archive/2009/03/09/76032.htmlLeon916Leon916Mon, 09 Mar 2009 14:04:00 GMThttp://www.shnenglu.com/Leon916/archive/2009/03/09/76032.htmlhttp://www.shnenglu.com/Leon916/comments/76032.htmlhttp://www.shnenglu.com/Leon916/archive/2009/03/09/76032.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/76032.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/76032.html

Leon916 2009-03-09 22:04 鍙戣〃璇勮
]]>
lcc闃呰涓http://www.shnenglu.com/Leon916/archive/2008/12/26/70401.htmlLeon916Leon916Fri, 26 Dec 2008 06:37:00 GMThttp://www.shnenglu.com/Leon916/archive/2008/12/26/70401.htmlhttp://www.shnenglu.com/Leon916/comments/70401.htmlhttp://www.shnenglu.com/Leon916/archive/2008/12/26/70401.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/70401.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/70401.html   鏈瀹規槗鐨勬槸絎簩绔狅紝鏄叧浜庡唴瀛樼鐞嗭紝鍒板畬涔嬪悗鎰熻璺烻TL鐨勫唴瀛樼鐞嗘湁鐐圭浉浼鹼紝閮芥槸鎶婅嚜宸辯鐞嗗垎閰嶇殑鍐呭瓨錛屽綋闇瑕佺殑鍐呭瓨涓嶅鐢ㄧ殑鏃跺欙紝鍦ㄨ皟鐢╩alloc閲嶆柊鐢寵銆?br>   瀵逛簬鍚庨潰鍑犵珷錛岃繕娌℃湁褰誨簳鐞嗚В錛岃繕闇瑕佽姳涓浜涙椂闂達紝杈硅浠g爜杈圭湅涔︼紝涓瀹氳鐞嗚В瀹冩槸濡備綍綆$悊絎﹀彿銆佹爣璇嗙鍜岃繛鎺ュ墠绔拰鍚庣鐨勬帴鍙c?br>
   榧撳姳涓涓嬭嚜宸憋紝絎竴嬈¤榪欎箞澶嶆潅鐨勪笢瑗匡紝浣嗘槸榪欐槸鎴愰暱鐨勫繀鐢變箣璺紝鍔犳補錛?br>
ps:鍙堣浠庡ご寮濮嬬湅浜嗭紝鏈変簺涓滆タ榪樻槸涓嶆噦錛佸姞娌癸紒錛侊紒



Leon916 2008-12-26 14:37 鍙戣〃璇勮
]]>
std:string瀛︿範http://www.shnenglu.com/Leon916/archive/2008/12/05/68694.htmlLeon916Leon916Fri, 05 Dec 2008 14:33:00 GMThttp://www.shnenglu.com/Leon916/archive/2008/12/05/68694.htmlhttp://www.shnenglu.com/Leon916/comments/68694.htmlhttp://www.shnenglu.com/Leon916/archive/2008/12/05/68694.html#Feedback3http://www.shnenglu.com/Leon916/comments/commentRss/68694.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/68694.html涔嬫墍浠ユ姏寮僣har*鐨勫瓧絎︿覆鑰岄夌敤C++鏍囧噯紼嬪簭搴撲腑鐨剆tring綾伙紝鏄洜涓轟粬鍜屽墠鑰呮瘮杈冭搗鏉ワ紝涓嶅繀鎷呭績鍐呭瓨鏄惁瓚沖銆佸瓧絎︿覆闀垮害絳夌瓑錛岃屼笖浣? 涓轟竴涓被鍑虹幇錛屼粬闆嗘垚鐨勬搷浣滃嚱鏁拌凍浠ュ畬鎴愭垜浠ぇ澶氭暟鎯呭喌涓?鐢氳嚦鏄?00%)鐨勯渶瑕併傛垜浠彲浠ョ敤 = 榪涜璧嬪兼搷浣滐紝== 榪涜姣旇緝錛? 鍋氫覆鑱旓紙鏄笉鏄緢綆鍗?錛夈傛垜浠敖鍙互鎶婂畠鐪嬫垚鏄疌++鐨勫熀鏈暟鎹被鍨嬨?br>   濂戒簡錛岃繘鍏ユ棰?#8230;……
棣栧厛錛屼負浜嗗湪鎴戜滑鐨勭▼搴忎腑浣跨敤string綾誨瀷錛屾垜浠繀欏誨寘鍚ご鏂囦歡 銆傚涓嬶細
   #include //娉ㄦ剰榪欓噷涓嶆槸string.h string.h鏄疌瀛楃涓插ご鏂囦歡

1錛庡0鏄庝竴涓狢++瀛楃涓?br>澹版槑涓涓瓧絎︿覆鍙橀噺寰堢畝鍗曪細
   string Str;
榪欐牱鎴戜滑灝卞0鏄庝簡涓涓瓧絎︿覆鍙橀噺錛屼絾鏃㈢劧鏄竴涓被錛屽氨鏈夋瀯閫犲嚱鏁板拰鏋愭瀯鍑芥暟銆備笂闈㈢殑澹版槑娌℃湁浼犲叆鍙傛暟錛屾墍浠ュ氨鐩存帴浣跨敤浜唖tring鐨勯粯璁ょ殑鏋勯犲嚱鏁幫紝榪欎釜鍑芥暟鎵浣滅殑灝辨槸鎶奡tr鍒濆鍖栦負涓涓┖瀛楃涓層係tring綾葷殑鏋勯犲嚱鏁板拰鏋愭瀯鍑芥暟濡備笅錛?br>a)    string s;  //鐢熸垚涓涓┖瀛楃涓瞫
b)    string s(str) //鎷瘋礉鏋勯犲嚱鏁?鐢熸垚str鐨勫鍒跺搧
c)    string s(str,stridx) //灝嗗瓧絎︿覆str鍐?#8220;濮嬩簬浣嶇疆stridx”鐨勯儴鍒嗗綋浣滃瓧絎︿覆鐨勫垵鍊?br>d)    string s(str,stridx,strlen) //灝嗗瓧絎︿覆str鍐?#8220;濮嬩簬stridx涓旈暱搴﹂《澶歴trlen”鐨勯儴鍒嗕綔涓哄瓧絎︿覆鐨勫垵鍊?br>e)    string s(cstr) //灝咰瀛楃涓蹭綔涓簊鐨勫垵鍊?br>f)    string s(chars,chars_len) //灝咰瀛楃涓插墠chars_len涓瓧絎︿綔涓哄瓧絎︿覆s鐨勫垵鍊箋?br>g)    string s(num,c) //鐢熸垚涓涓瓧絎︿覆錛屽寘鍚玭um涓猚瀛楃
h)    string s(beg,end) //浠ュ尯闂碽eg;end(涓嶅寘鍚玡nd)鍐呯殑瀛楃浣滀負瀛楃涓瞫鐨勫垵鍊?br>i)    s.~string() //閿姣佹墍鏈夊瓧絎︼紝閲婃斁鍐呭瓨
閮藉緢綆鍗曪紝鎴戝氨涓嶈В閲婁簡銆?br>2錛庡瓧絎︿覆鎿嶄綔鍑芥暟
   榪欓噷鏄疌++瀛楃涓茬殑閲嶇偣錛屾垜鍏堟妸鍚勭鎿嶄綔鍑芥暟緗楀垪鍑烘潵錛屼笉鍠滄鎶婃墍鏈夊嚱鏁伴兘鐪嬪畬鐨勪漢鍙互鍦ㄨ繖閲屾壘鑷繁鍠滄鐨勫嚱鏁幫紝鍐嶅埌鍚庨潰鐪嬩粬鐨勮緇嗚В閲娿?br>a) =,assign()   //璧嬩互鏂板?br>b) swap()   //浜ゆ崲涓や釜瀛楃涓茬殑鍐呭
c) +=,append(),push_back() //鍦ㄥ熬閮ㄦ坊鍔犲瓧絎?br>d) insert() //鎻掑叆瀛楃
e) erase() //鍒犻櫎瀛楃
f) clear() //鍒犻櫎鍏ㄩ儴瀛楃
g) replace() //鏇挎崲瀛楃
h) + //涓茶仈瀛楃涓?br>i) ==,!=,<,<=,>,>=,compare()  //姣旇緝瀛楃涓?br>j) size(),length()  //榪斿洖瀛楃鏁伴噺
k) max_size() //榪斿洖瀛楃鐨勫彲鑳芥渶澶т釜鏁?br>l) empty()  //鍒ゆ柇瀛楃涓叉槸鍚︿負絀?br>m) capacity() //榪斿洖閲嶆柊鍒嗛厤涔嬪墠鐨勫瓧絎﹀閲?br>n) reserve() //淇濈暀涓瀹氶噺鍐呭瓨浠ュ綰充竴瀹氭暟閲忕殑瀛楃
o) [ ], at() //瀛樺彇鍗曚竴瀛楃
p) >>,getline() //浠巗tream璇誨彇鏌愬?br>q) <<  //灝嗚皨鍊煎啓鍏tream
r) copy() //灝嗘煇鍊艱祴鍊間負涓涓狢_string
s) c_str() //灝嗗唴瀹逛互C_string榪斿洖
t) data() //灝嗗唴瀹逛互瀛楃鏁扮粍褰㈠紡榪斿洖
u) substr() //榪斿洖鏌愪釜瀛愬瓧絎︿覆
v)鏌ユ壘鍑芥暟
w)begin() end() //鎻愪緵綾諱技STL鐨勮凱浠e櫒鏀寔
x) rbegin() rend() //閫嗗悜榪唬鍣?br>y) get_allocator() //榪斿洖閰嶇疆鍣?br>涓嬮潰璇︾粏浠嬬粛錛?br>2錛? C++瀛楃涓插拰C瀛楃涓茬殑杞崲
   C++鎻愪緵鐨勭敱C++瀛楃涓插緱鍒板搴旂殑C_string鐨勬柟娉曟槸浣跨敤data()銆乧_str()鍜宑opy()錛屽叾涓紝data()浠ュ瓧絎︽暟緇勭殑褰㈠紡 榪斿洖瀛楃涓插唴瀹癸紝浣嗗茍涓嶆坊鍔?#8217;\0’銆俢_str()榪斿洖涓涓互‘\0’緇撳熬鐨勫瓧絎︽暟緇勶紝鑰宑opy()鍒欐妸瀛楃涓茬殑鍐呭澶嶅埗鎴栧啓鍏ユ棦鏈夌殑 c_string鎴栧瓧絎︽暟緇勫唴銆侰++瀛楃涓插茍涓嶄互’\0’緇撳熬銆傛垜鐨勫緩璁槸鍦ㄧ▼搴忎腑鑳戒嬌鐢–++瀛楃涓插氨浣跨敤錛岄櫎闈炰竾涓嶅緱宸蹭笉閫夌敤c_string銆傜敱 浜庡彧鏄畝鍗曚粙緇嶏紝璇︾粏浠嬬粛鎺犺繃錛岃皝鎯寵繘涓姝ヤ簡瑙d嬌鐢ㄤ腑鐨勬敞鎰忎簨欏瑰彲浠ョ粰鎴戠暀璦(鍒版垜鐨勬敹浠剁)銆傛垜璇︾粏瑙i噴銆?br>2錛? 澶у皬鍜屽閲忓嚱鏁?br>   涓涓狢++瀛楃涓插瓨鍦ㄤ笁縐嶅ぇ灝忥細a)鐜版湁鐨勫瓧絎︽暟錛屽嚱鏁版槸size()鍜宭ength()錛屼粬浠瓑鏁堛侲mpty()鐢ㄦ潵媯鏌ュ瓧絎︿覆鏄惁涓虹┖銆? b)max_size() 榪欎釜澶у皬鏄寚褰撳墠C++瀛楃涓叉渶澶氳兘鍖呭惈鐨勫瓧絎︽暟錛屽緢鍙兘鍜屾満鍣ㄦ湰韜殑闄愬埗鎴栬呭瓧絎︿覆鎵鍦ㄤ綅緗繛緇唴瀛樼殑澶у皬鏈夊叧緋匯傛垜浠竴鑸儏鍐典笅涓嶇敤鍏沖績浠栵紝搴旇澶у皬 瓚沖鎴戜滑鐢ㄧ殑銆備絾鏄笉澶熺敤鐨勮瘽錛屼細鎶涘嚭length_error寮傚父c)capacity()閲嶆柊鍒嗛厤鍐呭瓨涔嬪墠 string鎵鑳藉寘鍚殑鏈澶у瓧絎︽暟銆傝繖閲屽彟涓涓渶瑕佹寚鍑虹殑鏄痳eserve()鍑芥暟錛岃繖涓嚱鏁頒負string閲嶆柊鍒嗛厤鍐呭瓨銆傞噸鏂板垎閰嶇殑澶у皬鐢卞叾鍙傛暟鍐沖畾錛? 榛樿鍙傛暟涓?錛岃繖鏃跺欎細瀵箂tring榪涜闈炲己鍒舵х緝鍑忋?br>
榪樻湁蹇呰鍐嶉噸澶嶄竴涓婥++瀛楃涓插拰C瀛楃涓茶漿鎹㈢殑闂錛岃澶氫漢浼氶亣鍒拌繖鏍風殑闂? 棰橈紝鑷繁鍋氱殑紼嬪簭瑕佽皟鐢ㄥ埆浜虹殑鍑芥暟銆佺被浠涔堢殑錛堟瘮濡傛暟鎹簱榪炴帴鍑芥暟Connect(char*,char*)錛夛紝浣嗗埆浜虹殑鍑芥暟鍙傛暟鐢ㄧ殑鏄痗har*褰㈠紡 鐨勶紝鑰屾垜浠煡閬擄紝c_str()銆乨ata()榪斿洖鐨勫瓧絎︽暟緇勭敱璇ュ瓧絎︿覆鎷ユ湁錛屾墍浠ユ槸涓縐峜onst char*,瑕佹兂浣滀負涓婇潰鎻愬強鐨勫嚱鏁扮殑鍙傛暟錛岃繕蹇呴』鎷瘋礉鍒頒竴涓猚har*,鑰屾垜浠殑鍘熷垯鏄兘涓嶄嬌鐢–瀛楃涓插氨涓嶄嬌鐢ㄣ傞偅涔堬紝榪欐椂鍊欐垜浠殑澶勭悊鏂瑰紡鏄細濡傛灉 姝ゅ嚱鏁板鍙傛暟(涔熷氨鏄痗har*)鐨勫唴瀹逛笉淇敼鐨勮瘽錛屾垜浠彲浠ヨ繖鏍稢onnect((char*)UserID.c_str(), (char*)PassWD.c_str()),浣嗘槸榪欐椂鍊欐槸瀛樺湪鍗遍櫓鐨勶紝鍥犱負榪欐牱杞崲鍚庣殑瀛楃涓插叾瀹炴槸鍙互淇敼鐨勶紙鏈夊叴瓚e湴鍙互鑷繁璇曚竴璇曪級錛屾墍浠ユ垜寮? 璋冮櫎闈炲嚱鏁拌皟鐢ㄧ殑鏃跺欎笉瀵瑰弬鏁拌繘琛屼慨鏀癸紝鍚﹀垯蹇呴』鎷瘋礉鍒頒竴涓猚har*涓婂幓銆傚綋鐒訛紝鏇寸ǔ濡ョ殑鍔炴硶鏄棤璁轟粈涔堟儏鍐甸兘鎷瘋礉鍒頒竴涓猚har*涓婂幓銆傚悓鏃舵垜浠篃紲? 紲風幇鍦ㄤ粛鐒朵嬌鐢–瀛楃涓茶繘琛岀紪紼嬬殑楂樻墜浠紙璇翠粬浠槸楂樻墜涓鐐瑰効涔熶笉涓鴻繃錛屼篃璁稿湪鎴戜滑榪樼┛寮瑁嗚¥鐨勬椂鍊欎粬浠氨寮濮嬬紪紼嬩簡錛屽搱鍝?#8230;錛夊啓鐨勫嚱鏁伴兘姣旇緝瑙勮寖錛岄偅鏍? 鎴戜滑灝變笉蹇呰繘琛屽己鍒惰漿鎹簡銆?br>
2錛?鍏冪礌瀛樺彇
   鎴戜滑鍙互浣跨敤涓嬫爣鎿嶄綔絎]鍜屽嚱鏁癮t()瀵瑰厓绱犲寘鍚殑瀛楃榪涜璁塊棶銆備絾鏄簲璇ユ敞鎰忕殑鏄搷浣滅[]騫朵笉媯鏌ョ儲寮曟槸鍚︽湁鏁堬紙鏈夋晥绱㈠紩 0~str.length()錛夛紝濡傛灉绱㈠紩澶辨晥錛屼細寮曡搗鏈畾涔夌殑琛屼負銆傝宎t()浼氭鏌ワ紝濡傛灉浣跨敤at()鐨勬椂鍊欑儲寮曟棤鏁堬紝浼氭姏鍑? out_of_range寮傚父銆?br>   鏈変竴涓緥澶栦笉寰椾笉璇達紝const string a;鐨勬搷浣滅[]瀵圭儲寮曞兼槸a.length()浠嶇劧鏈夋晥錛屽叾榪斿洖鍊兼槸’\0’銆傚叾浠栫殑鍚勭鎯呭喌錛宎.length()绱㈠紩閮芥槸鏃犳晥鐨勩備婦渚嬪涓嬶細
const string Cstr(“const string”);
string Str(“string”);

Str[3];    //ok
Str.at(3);  //ok

Str[100]; //鏈畾涔夌殑琛屼負
Str.at(100);  //throw out_of_range

Str[Str.length()]  //鏈畾涔夎涓?br>Cstr[Cstr.length()] //榪斿洖 ‘\0’
Str.at(Str.length());//throw out_of_range
Cstr.at(Cstr.length()) ////throw out_of_range

鎴戜笉璧炴垚綾諱技浜庝笅闈㈢殑寮曠敤鎴栨寚閽堣祴鍊鹼細
char& r=s[2];
char* p= &s[3];
鍥犱負涓鏃﹀彂鐢熼噸鏂板垎閰嶏紝r,p绔嬪嵆澶辨晥銆傞伩鍏嶇殑鏂規硶灝辨槸涓嶄嬌鐢ㄣ?br>
2錛?姣旇緝鍑芥暟
   C++瀛楃涓叉敮鎸佸父瑙佺殑姣旇緝鎿嶄綔絎︼紙>,>=,<,<=,==,!=錛夛紝鐢氳嚦鏀寔string涓嶤-string鐨勬瘮杈?濡? str<”hello”)銆傚湪浣跨敤>,>=,<,<=榪欎簺鎿嶄綔絎︾殑鏃跺欐槸鏍規嵁“褰撳墠瀛楃鐗規?#8221;灝嗗瓧絎︽寜瀛楀吀欏哄簭榪涜閫愪竴寰? 姣旇緝銆傚瓧鍏告帓搴忛潬鍓嶇殑瀛楃灝忥紝姣旇緝鐨勯『搴忔槸浠庡墠鍚戝悗姣旇緝錛岄亣鍒頒笉鐩哥瓑鐨勫瓧絎﹀氨鎸夎繖涓綅緗笂鐨勪袱涓瓧絎︾殑姣旇緝緇撴灉紜畾涓や釜瀛楃涓茬殑澶у皬銆傚悓 鏃訛紝string(“aaaa”)    鍙︿竴涓姛鑳藉己澶х殑姣旇緝鍑芥暟鏄垚鍛樺嚱鏁癱ompare()銆備粬鏀寔澶氬弬鏁板鐞嗭紝鏀寔鐢ㄧ儲寮曞煎拰闀垮害瀹氫綅瀛愪覆鏉ヨ繘琛屾瘮杈冦備粬榪斿洖涓涓暣鏁版潵琛ㄧず姣旇緝緇撴灉錛岃繑 鍥炲兼剰涔夊涓嬶細0-鐩哥瓑 銆?-澶т簬 <0-灝忎簬銆備婦渚嬪涓嬶細
   string s(“abcd”);
   
   s.compare(“abcd”); //榪斿洖0
   s.compare(“dcba”); //榪斿洖涓涓皬浜?鐨勫?br>   s.compare(“ab”); //榪斿洖澶т簬0鐨勫?br>   
s.compare(s); //鐩哥瓑
   s.compare(0,2,s,2,2); //鐢?#8221;ab”鍜?#8221;cd”榪涜姣旇緝 灝忎簬闆?br>   s.compare(1,2,”bcx”,2); //鐢?#8221;bc”鍜?#8221;bc”姣旇緝銆?br>鎬庝箞鏍鳳紵鍔熻兘澶熷叏鐨勫惂錛佷粈涔堬紵榪樹笉鑳芥弧瓚充綘鐨勮儍鍙o紵濂藉惂錛岄偅絳夌潃錛屽悗闈㈡湁鏇翠釜鎬у寲鐨勬瘮杈冪畻娉曘傚厛緇欎釜鎻愮ず錛屼嬌鐢ㄧ殑鏄疭TL鐨勬瘮杈冪畻娉曘備粈涔堬紵瀵筍TL涓紿嶄笉閫氾紵闈狅紝浣犻噸淇惂錛?br>
2錛? 鏇存敼鍐呭
榪欏湪瀛楃涓茬殑鎿嶄綔涓崰浜嗗緢澶т竴閮ㄥ垎銆?br>棣栧厛璁茶祴鍊鹼紝絎竴涓祴鍊兼柟娉曞綋鐒舵槸浣跨敤鎿嶄綔絎?錛屾柊鍊煎彲浠ユ槸string(濡傦細s=ns) 銆乧_string(濡傦細s=”gaint”)鐢氳嚦鍗曚竴瀛楃錛堝錛歴=’j’錛夈傝繕鍙互浣跨敤鎴愬憳鍑芥暟assign()錛岃繖涓垚鍛樺嚱鏁板彲浠ヤ嬌浣犳洿鐏墊椿鐨勫瀛楃涓茶祴鍊箋傝繕鏄婦渚嬭鏄庡惂錛?br>s.assign(str); //涓嶈
s.assign(str,1,3);//濡傛灉str鏄?#8221;iamangel” 灝辨槸鎶?#8221;ama”璧嬬粰瀛楃涓?br>s.assign(str,2,string::npos);//鎶婂瓧絎︿覆str浠庣儲寮曞?寮濮嬪埌緇撳熬璧嬬粰s
s.assign(“gaint”); //涓嶈
s.assign(“nico”,5);//鎶?#8217;n’ ‘I’ ‘c’ ‘o’ ‘\0’璧嬬粰瀛楃涓?br>s.assign(5,’x’);//鎶婁簲涓獂璧嬬粰瀛楃涓?br>鎶婂瓧絎︿覆娓呯┖鐨勬柟娉曟湁涓変釜錛歴=””;s.clear();s.erase();(鎴戣秺鏉ヨ秺瑙夊緱涓句緥姣旇璇濊鍒漢瀹規槗鎳傦紒)銆?br>string鎻愪緵浜嗗緢澶氬嚱鏁扮敤浜庢彃鍏ワ紙insert錛夈佸垹闄わ紙erase錛夈佹浛鎹紙replace錛夈佸鍔犲瓧絎︺?br>鍏堣澧炲姞瀛楃錛堣繖閲岃鐨勫鍔犳槸鍦ㄥ熬宸翠笂錛夛紝鍑芥暟鏈?+=銆乤ppend()銆乸ush_back()銆備婦渚嬪涓嬶細
s+=str;//鍔犱釜瀛楃涓?br>s+=”my name is jiayp”;//鍔犱釜C瀛楃涓?br>s+=’a’;//鍔犱釜瀛楃

s.append(str);
s.append(str,1,3);//涓嶈В閲婁簡 鍚屽墠闈㈢殑鍑芥暟鍙傛暟assign鐨勮В閲?br>s.append(str,2,string::npos)//涓嶈В閲婁簡

s.append(“my name is jiayp”);
s.append(“nico”,5);
s.append(5,’x’);

 

    瀛楃涓叉搷浣滄槸涓涓笉灝忕殑涓婚,鍦ㄦ爣鍑咰++涓?string瀛楃涓茬被鎴愪負涓涓爣鍑?涔嬫墍浠ユ姏寮僣har*鐨勫瓧絎︿覆鑰岄夌敤C++鏍囧噯紼嬪簭搴撲腑鐨剆tring綾伙紝鏄洜涓轟粬鍜屽墠鑰呮瘮杈冭搗鏉ワ紝涓嶅繀鎷呭績鍐呭瓨鏄惁瓚沖銆佸瓧絎︿覆闀垮害絳夌瓑錛岃屼笖浣滀負涓涓被鍑虹幇錛屼粬闆嗘垚鐨勬搷浣滃嚱鏁拌凍浠ュ畬鎴愭垜浠ぇ澶氭暟鎯呭喌涓嬬殑闇瑕?
    涓嬮潰鎴戜滑棣栧厛浠庝竴浜涚ず渚嬪紑濮嬪涔犱笅string綾葷殑浣跨敤.
1)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s("hehe");
    cout<<s<<endl;
    cin.get();
}
2)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    char chs[] = "hehe";
    string s(chs);
    cout<<s<<endl;
    cin.get();
}
3)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    char chs[] = "hehe";
    string s(chs,1,3);    //鎸囧畾浠巆hs鐨勭儲寮?寮濮?鏈鍚庡鍒?涓瓧鑺?br>    cout<<s<<endl;
    cin.get();
}
4)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s1("hehe");
    string s2(s1);   
    cout<<s2<<endl;
    cin.get();
}
5)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s1("hehe",2,3);
    string s2(s1);   
    cout<<s2<<endl;
    cin.get();
}
6)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    char chs[] = "hehe";
    string s(chs,3);    //灝哻hs鍓?涓瓧絎︿綔涓哄垵鍊兼瀯閫?br>    cout<<s<<endl;
    cin.get();
}
7)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s(10,'k');    //鍒嗛厤10涓瓧絎?鍒濆奸兘鏄?k'
    cout<<s<<endl;
    cin.get();
}
//浠ヤ笂鏄痵tring綾誨疄渚嬬殑鏋勯犳墜孌?閮藉緢綆鍗?

9)
//璧嬫柊鍊?br>#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s(10,'k');    //鍒嗛厤10涓瓧絎?鍒濆奸兘鏄?k'
    cout<<s<<endl;
    s = "hehehehe";
    cout<<s<<endl;
    s.assign("kdje");
    cout<<s<<endl;
    s.assign("fkdhfkdfd",5);    //閲嶆柊鍒嗛厤鎸囧畾瀛楃涓茬殑鍓?鐨勫厓绱犲唴瀹?br>    cout<<s<<endl;       
    cin.get();
}
10)
//swap鏂規硶浜ゆ崲
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s1 = "hehe";
    string s2 = "gagaga";
    cout<<"s1 : "<<s1<<endl;
    cout<<"s2 : "<<s2<<endl;
    s1.swap(s2);
    cout<<"s1 : "<<s1<<endl;
    cout<<"s2 : "<<s2<<endl;
    cin.get();
}
11)
//+=,append(),push_back()鍦ㄥ熬閮ㄦ坊鍔犲瓧絎?br>#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "hehe";
    s += "gaga";
    cout<<s<<endl;
    s.append("鍢垮樋");    //append()鏂規硶鍙互娣誨姞瀛楃涓?br>    cout<<s<<endl;
    s.push_back('k');    //push_back()鏂規硶鍙兘娣誨姞涓涓瓧絎?..
    cout<<s<<endl;
    cin.get();
}
12)
//insert() 鎻掑叆瀛楃.鍏跺疄,insert榪愮敤濂?涓庡叾浠栫殑鎻掑叆鎿嶄綔鏄竴鏍風殑.
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "hehe";
    s.insert(0,"澶撮儴");            //鍦ㄥご閮ㄦ彃鍏?br>    s.insert(s.size(),"灝鵑儴");    //鍦ㄥ熬閮ㄦ彃鍏?br>    s.insert(s.size()/2,"涓棿");//鍦ㄤ腑闂存彃鍏?br>    cout<<s<<endl;
    cin.get();
}
13)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg";
    s.erase(0,1);    //浠庣儲寮?鍒扮儲寮?,鍗沖垹闄ゆ帀浜?a'
    cout<<s<<endl;
    //鍏跺疄,榪樺彲浠ヤ嬌鐢╮eplace鏂規硶鏉ユ墽琛屽垹闄ゆ搷浣?br>    s.replace(2,3,"");//鍗沖皢鎸囧畾鑼冨洿鍐呯殑瀛楃鏇挎崲鎴?",鍗沖彉鐩稿垹闄や簡
    cout<<s<<endl;
    cin.get();
}

14)
//clear() 鍒犻櫎鍏ㄩ儴瀛楃
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg";
    cout<<s.length()<<endl;
    s.clear();
    cout<<s.length()<<endl;
    //浣跨敤earse鏂規硶鍙樼浉鍏ㄥ垹闄?br>    s = "dkjfd";
    cout<<s.length()<<endl;
    s.erase(0,s.length());
    cout<<s.length()<<endl;

    cin.get();
}
15)
//replace() 鏇挎崲瀛楃
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg";
    s.replace(2,3,"!!!!!");//浠庣儲寮?寮濮?涓瓧鑺傜殑瀛楃鍏ㄦ浛鎹㈡垚"!!!!!"
    cout<<s<<endl;
    cin.get();
}
16)
//==,!=,<,<=,>,>=,compare()  姣旇緝瀛楃涓?br>#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s1 = "abcdefg";
    string s2 = "abcdefg";   
    if (s1==s2)cout<<"s1 == s2"<<endl;
    else cout<<"s1 != s2"<<endl;
   
    if (s1!=s2)cout<<"s1 != s2"<<endl;
    else cout<<"s1 == s2"<<endl;
   
    if (s1>s2)cout<<"s1 > s2"<<endl;
    else cout<<"s1 <= s2"<<endl;
   
    if (s1<=s2)cout<<"s1 <= s2"<<endl;
    else cout<<"s1 > s2"<<endl;

    cin.get();
}
17)
//size(),length()  榪斿洖瀛楃鏁伴噺
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg";
    cout<<s.size()<<endl;
    cout<<s.length()<<endl;

    cin.get();
}
18)
//max_size() 榪斿洖瀛楃鐨勫彲鑳芥渶澶т釜鏁?br>#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg";
    cout<<s.max_size()<<endl;

    cin.get();
}
19)
//empty()  鍒ゆ柇瀛楃涓叉槸鍚︿負絀?br>#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s ;
    if (s.empty())
        cout<<"s 涓虹┖."<<endl;
    else
        cout<<"s 涓嶄負絀?"<<endl;

    s = s + "abcdefg";
    if (s.empty())
        cout<<"s 涓虹┖."<<endl;
    else
        cout<<"s 涓嶄負絀?"<<endl;

    cin.get();
}
20)
// [ ], at() 瀛樺彇鍗曚竴瀛楃
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg1111";
   
    cout<<"use []:"<<endl;
    for(int i=0; i<s.length(); i++)
    {
        cout<<s[i]<<endl;
    }
    cout<<endl;

    cout<<"use at():"<<endl;
    for(int i=0; i<s.length(); i++)
    {
        cout<<s.at(i)<<endl;
    }
    cout<<endl;
   
    cin.get();
}
21)
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg1111";
   
    const char * chs1 = s.c_str();
    const char * chs2 = s.data();

    cout<<"use at():"<<endl;
    int i;
    for(i=0; i<s.length(); i++)
    {
        cout<<"c_str() : "<<chs1[i]<<endl;
        cout<<"data() : "<<chs2[i]<<endl;
    }
    cout<<"c_str() : "<<chs1<<endl;
    cout<<"data() : "<<chs2<<endl;
    cout<<endl;
   
    cin.get();
}
22)
// substr() 榪斿洖鏌愪釜瀛愬瓧絎︿覆
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg1111";
   
    string str = s.substr(5,3);//浠庣儲寮?寮濮?涓瓧鑺?br>    cout<<str<<endl;
   
    cin.get();
}
23)
// find 鏌ユ壘鍑芥暟
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg1111";
    string pattern = "fg";
    string::size_type pos;
    pos = s.find(pattern,0);        //浠庣儲寮?寮濮?鏌ユ壘絎﹀悎瀛楃涓?f"鐨勫ご绱㈠紩
    cout<<pos<<endl;
    string str = s.substr(pos,pattern.size());
    cout<<str<<endl;
    cin.get();
}
24)
// begin() end() 鎻愪緵綾諱技STL鐨勮凱浠e櫒鏀寔
#include <string>
#include <iostream>
using namespace std;

void main()
{
    string s = "abcdefg1111";
    for(string::iterator iter = s.begin(); iter!=s.end(); iter++)
    {
        cout<<*iter<<endl;
    }
    cout<<endl;

    cin.get();
}
        涓涓狢++瀛楃涓插瓨鍦ㄤ笁縐嶅ぇ灝忥細a)鐜版湁鐨勫瓧絎︽暟錛屽嚱鏁版槸size()鍜宭ength()錛屼粬浠瓑鏁堛? Empty()鐢ㄦ潵媯鏌ュ瓧絎︿覆鏄惁涓虹┖銆俠)max_size() 榪欎釜澶у皬鏄寚褰撳墠C++瀛楃涓叉渶澶氳兘鍖呭惈鐨勫瓧絎︽暟錛屽緢鍙兘鍜屾満鍣ㄦ湰韜殑闄愬埗鎴栬呭瓧絎︿覆鎵鍦ㄤ綅緗繛緇唴瀛樼殑澶у皬鏈夊叧緋匯傛垜浠竴鑸儏鍐典笅涓嶇敤鍏沖績浠栵紝搴旇澶у皬 瓚沖鎴戜滑鐢ㄧ殑銆備絾鏄笉澶熺敤鐨勮瘽錛屼細鎶涘嚭length_error寮傚父c)capacity()閲嶆柊鍒嗛厤鍐呭瓨涔嬪墠 string鎵鑳藉寘鍚殑鏈澶у瓧絎︽暟銆傝繖閲屽彟涓涓渶瑕佹寚鍑虹殑鏄痳eserve()鍑芥暟錛岃繖涓嚱鏁頒負string閲嶆柊鍒嗛厤鍐呭瓨銆傞噸鏂板垎閰嶇殑澶у皬鐢卞叾鍙傛暟鍐沖畾錛? 榛樿鍙傛暟涓?錛岃繖鏃跺欎細瀵箂tring榪涜闈炲己鍒舵х緝鍑?/span>

Leon916 2008-12-05 22:33 鍙戣〃璇勮
]]>
std::Vector瀛︿範http://www.shnenglu.com/Leon916/archive/2008/12/05/68638.htmlLeon916Leon916Fri, 05 Dec 2008 05:21:00 GMThttp://www.shnenglu.com/Leon916/archive/2008/12/05/68638.htmlhttp://www.shnenglu.com/Leon916/comments/68638.htmlhttp://www.shnenglu.com/Leon916/archive/2008/12/05/68638.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/68638.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/68638.html 鎸変笂闈㈢殑璇硶錛屽垱寤轟竴涓獀ector錛屾槸鎸夌収v鐨?span style="color: #ff0000;">瀹為檯鍏冪礌涓暟鍒涘緩鏂皏ector鐨勩傚氨鏄錛屽鏋渧涓厓绱犳槸1,2,3,閭d箞錛寁New涓殑鍏冪礌鏄?,2,3錛屽茍涓旓紝vNew鐨?span style="color: #ff0000;">鎬誨閲?/span>涔熸槸3.
涔熷氨鏄細vNew鐨勬誨閲忓彇鍐充簬v鐨勫疄闄呭厓绱犱釜鏁般?/span>

pVec->clear();
clear()鍙槸鍒犻櫎[first,last)鍖洪棿涓殑鎵鏈夊厓绱狅紝浣嗗茍涓嶉噴鏀懼叾鍐呭瓨銆?

(std::vector  <int >)(*pVec)
涔熷氨鏄垱寤轟竴涓復鏃跺璞ector <int>錛屾樉鐒訛紝榪欎釜涓存椂瀵硅薄鐨勬誨閲忔槸鍙栧喅浜?pVec鐨勫疄闄呭厓绱犱釜鏁扮殑錛岃岀粡榪?
pVec->clear();鐨刾Vect鐨勫疄闄呭厓绱犱釜鏁版槸0錛屽洜姝わ紝pVec- >swap( (std::vector  <int >)(*pVec) ); 灝嗚繖涓復鏃跺璞′笌pVec浜ゆ崲鍚庯紝瀹冪殑鎬誨閲忓彉鎴愪簡0銆?
錛坴ector涓殑swap()瀹炵幇鐨勬槸錛氬皢first銆乴ast,end_of_storage錛堟誨閲忥級渚濇浜ゆ崲錛夈?

鍥犳錛屽疄鐜頒簡*pVec娌′嬌鐢ㄥ唴瀛樼殑閲婃斁銆?

Leon916 2008-12-05 13:21 鍙戣〃璇勮
]]>
絎旇瘯棰?http://www.shnenglu.com/Leon916/archive/2008/10/28/65277.htmlLeon916Leon916Tue, 28 Oct 2008 00:54:00 GMThttp://www.shnenglu.com/Leon916/archive/2008/10/28/65277.htmlhttp://www.shnenglu.com/Leon916/comments/65277.htmlhttp://www.shnenglu.com/Leon916/archive/2008/10/28/65277.html#Feedback0http://www.shnenglu.com/Leon916/comments/commentRss/65277.htmlhttp://www.shnenglu.com/Leon916/services/trackbacks/65277.htmlcout << sizeof*(p) << endl;
璇烽棶榪欎釜鐨勮緭鍑猴紵

緇忚繃璋冭瘯錛屾垜鍙戠幇sizeof錛婏紙锝愶級鐨勫兼槸锝愮被鍨嬫墍鍗犵殑瀛楄妭鏁般?br>char杈撳嚭涓?錛宒ouble錛?.


char x[0];
x鏄粈涔堢被鍨嬶紵
鎴戝湪VS2005涓嬭皟璇曪紝緇撴灉鏄敊璇?nbsp; cannot allocate an array of constant size 0 銆?br>

Leon916 2008-10-28 08:54 鍙戣〃璇勮
]]>
久久不见久久见免费视频7| 亚洲精品高清一二区久久| 精品久久久久久久久午夜福利| 亚洲精品乱码久久久久66| 久久国产乱子精品免费女| 久久精品18| 欧美国产成人久久精品| 人妻无码αv中文字幕久久| 97热久久免费频精品99| 久久夜色精品国产亚洲av| 久久亚洲精品人成综合网| 国产福利电影一区二区三区久久久久成人精品综合 | 久久久精品国产sm调教网站 | 久久精品夜夜夜夜夜久久| 国产69精品久久久久99尤物| 97久久国产综合精品女不卡 | 久久99国产综合精品| 午夜精品久久久内射近拍高清| 人妻丰满AV无码久久不卡 | 久久99久国产麻精品66| 久久有码中文字幕| 久久国产亚洲高清观看| 日韩欧美亚洲综合久久 | 天天综合久久久网| 无码专区久久综合久中文字幕| 亚洲国产成人久久一区久久| 国产成人久久精品激情| 久久婷婷人人澡人人爽人人爱| 久久中文字幕无码专区 | 91久久婷婷国产综合精品青草 | 狠狠色丁香久久婷婷综合蜜芽五月 | 国产精品久久久久久久 | 久久亚洲高清综合| 久久国产热这里只有精品| 97r久久精品国产99国产精| 久久国产精品无码一区二区三区| 久久亚洲精品成人无码网站| 2020久久精品亚洲热综合一本| 久久这里的只有是精品23| 三级三级久久三级久久| 亚洲av伊人久久综合密臀性色|