﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-sopherwenxin学习笔记</title><link>http://www.cppblog.com/sopherwenxin/</link><description>刀锋上的舞者: 我是风中的落叶，看我如何飞翔</description><language>zh-cn</language><lastBuildDate>Mon, 13 Apr 2026 10:49:06 GMT</lastBuildDate><pubDate>Mon, 13 Apr 2026 10:49:06 GMT</pubDate><ttl>60</ttl><item><title>不用中间变量，实现变量值的互换（未完待续）</title><link>http://www.cppblog.com/sopherwenxin/archive/2006/02/19/3334.html</link><dc:creator>sopherwenxin</dc:creator><author>sopherwenxin</author><pubDate>Sun, 19 Feb 2006 07:46:00 GMT</pubDate><guid>http://www.cppblog.com/sopherwenxin/archive/2006/02/19/3334.html</guid><wfw:comment>http://www.cppblog.com/sopherwenxin/comments/3334.html</wfw:comment><comments>http://www.cppblog.com/sopherwenxin/archive/2006/02/19/3334.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/sopherwenxin/comments/commentRss/3334.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sopherwenxin/services/trackbacks/3334.html</trackback:ping><description><![CDATA[<P>方法１　<BR>#include&nbsp;&lt;stdio.h&gt;<BR>void&nbsp;main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;i=８0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;j=１0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=i+j;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j=i-j;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=i-j;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("i=%d\n",i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf("j=%d\n",j);<BR>}<BR>方法２<BR>#include &lt;stdio.h&gt;<BR>void main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i=８0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int j=１0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i^=j;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j^=i;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i^=j;<BR>　　printf("i=%d\n",i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("j=%d\n",j);<BR>}<BR>方法３<BR>#include &lt;stdio.h&gt;<BR>void main()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i=８0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int j=１0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=i+j-(j=i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j=j+i-(i=j);<BR>　　printf("i=%d\n",i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("j=%d\n",j);<BR>}<BR><BR><BR><BR><BR><BR><BR></P><img src ="http://www.cppblog.com/sopherwenxin/aggbug/3334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sopherwenxin/" target="_blank">sopherwenxin</a> 2006-02-19 15:46 <a href="http://www.cppblog.com/sopherwenxin/archive/2006/02/19/3334.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于scanf的返回值</title><link>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2740.html</link><dc:creator>sopherwenxin</dc:creator><author>sopherwenxin</author><pubDate>Sun, 15 Jan 2006 05:10:00 GMT</pubDate><guid>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2740.html</guid><wfw:comment>http://www.cppblog.com/sopherwenxin/comments/2740.html</wfw:comment><comments>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2740.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sopherwenxin/comments/commentRss/2740.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sopherwenxin/services/trackbacks/2740.html</trackback:ping><description><![CDATA[关于scanf的返回值，MSDN里是这样写的：<BR>Both scanf and wscanf return the number of fields successfully converted<BR> and assigned; the return value does not include fields that were read but <BR>not assigned. A return value of 0 indicates that no fields were assigned. <BR>The return value is EOF for an error or if the end-of-file character or the <BR>end-of-string character is nocountered in the first attempt to read a character.<BR>如：<BR>scanf("%d%d", &amp;a, &amp;b);<BR>如果a和b都被成功读入，那么scanf的返回值就是2<BR>如果只有a被成功读入，返回值为1<BR>如果a和b都未被成功读入，返回值为0<BR>如果遇到错误或遇到end of file，返回值为EOF。<img src ="http://www.cppblog.com/sopherwenxin/aggbug/2740.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sopherwenxin/" target="_blank">sopherwenxin</a> 2006-01-15 13:10 <a href="http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2740.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>女孩写给男孩的爱情脚本</title><link>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2737.html</link><dc:creator>sopherwenxin</dc:creator><author>sopherwenxin</author><pubDate>Sun, 15 Jan 2006 03:40:00 GMT</pubDate><guid>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2737.html</guid><wfw:comment>http://www.cppblog.com/sopherwenxin/comments/2737.html</wfw:comment><comments>http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2737.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sopherwenxin/comments/commentRss/2737.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sopherwenxin/services/trackbacks/2737.html</trackback:ping><description><![CDATA[<TABLE class="fixedTable blogpost" cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=ellipse><SPAN class=bvTitle id=subjcns!1pHDbxJk0NMSWlfamGg1sN5Q!148><STRONG>女孩写给男孩的爱情脚本</STRONG></SPAN></TD></TR>
<TR>
<TD class=bvh8><STRONG></STRONG></TD></TR>
<TR>
<TD id=msgcns!1pHDbxJk0NMSWlfamGg1sN5Q!148>
<DIV>Dear all: <BR>result love(boy, girl) <BR>{- <BR>　　if ( boy.有房() and boy.有车() ) <BR>　　　{- <BR>　　　　boy.set(nothing); <BR>　　　　return girl.嫁给(boy); <BR>　　} <BR>　　if ( girl.愿意等() ) <BR>　　{- <BR>　　　while( ! (boy.赚钱 ＞ 100,000 and girl.感情 ＞ 8 ) <BR>　　　{- <BR>　　　　for ( day=1; day ＜=365; day++) <BR>　　　　{- <BR>　　　　　if ( day == 情人节 ) <BR>　　　　　if ( boy.givegirl(玫瑰) ) <BR>　　　　　　girl.感情++; <BR>　　　　　　else <BR>　　　　　　　girl.感情--; <BR>　　　　　　　 if( day == girl.生日) <BR>　　　　　if ( boy.givegirl(玫瑰) ) <BR>　　　　　　　　girl.感情++; <BR>　　　　　　　　else <BR>　　　　　　　　girl.感情--; <BR>　　　　　　boy.拼命赚钱(); <BR>　　　　　 } <BR>　　　　 } <BR>　　　　if ( boy.有房() and boy.有车() ) <BR>　　　{- <BR>　　 boy.set(nothing); <BR>　return girl.嫁给(boy); <BR>　} <BR>　　　年龄++; <BR>　　　girl.感情--; <BR>　　 } </DIV>
<DIV>}</DIV></TD></TR></TBODY></TABLE><img src ="http://www.cppblog.com/sopherwenxin/aggbug/2737.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sopherwenxin/" target="_blank">sopherwenxin</a> 2006-01-15 11:40 <a href="http://www.cppblog.com/sopherwenxin/archive/2006/01/15/2737.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>第三届全国高校程序设计大赛赛题问题5：导线交叉  </title><link>http://www.cppblog.com/sopherwenxin/archive/2006/01/14/2729.html</link><dc:creator>sopherwenxin</dc:creator><author>sopherwenxin</author><pubDate>Sat, 14 Jan 2006 10:08:00 GMT</pubDate><guid>http://www.cppblog.com/sopherwenxin/archive/2006/01/14/2729.html</guid><wfw:comment>http://www.cppblog.com/sopherwenxin/comments/2729.html</wfw:comment><comments>http://www.cppblog.com/sopherwenxin/archive/2006/01/14/2729.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cppblog.com/sopherwenxin/comments/commentRss/2729.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sopherwenxin/services/trackbacks/2729.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">问题</SPAN><SPAN lang=EN-US>5</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：导线交叉</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个接线箱中上下各有</SPAN><SPAN lang=EN-US>n</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个端子，顶部的每个端子分别与底部的某个端子相连，形成一个完美匹配。</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由于端子匹配的不同，导线会产生各种可能的交叉。在如下的例子中导线交叉点共有</SPAN><SPAN lang=EN-US>22</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个：<BR></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"></v:path><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:lock aspectratio="t" v:ext="edit"></o:lock></v:shapetype></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><SPAN lang=EN-US style="FONT-SIZE: 10.5pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600">&nbsp;<IMG style="WIDTH: 177px; HEIGHT: 121px" height=90 alt=t_2.bmp src="http://www.cppblog.com/images/cppblog_com/sopherwenxin/801/t_2.bmp" width=120 border=0></v:shapetype></SPAN><BR>编一个程序计算给定的连线方式下导线交叉点的总数。</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">输入：</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一行含</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个整数，表示实例个数。</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">每个实例有一行输入，含</SPAN><SPAN lang=EN-US>n</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个整数，第</SPAN><SPAN lang=EN-US>i</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个整数表示与顶部第</SPAN><SPAN lang=EN-US>i</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个端子相连接的底部端子的编号</SPAN><SPAN lang=EN-US>(1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">≤</SPAN><SPAN lang=EN-US>i</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">≤</SPAN><SPAN lang=EN-US>n)</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。每个整数用空格隔开。</SPAN><SPAN lang=EN-US><SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">输出：</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一行含</SPAN><SPAN lang=EN-US>1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个整数，表示实例的序号</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二行输出交叉点的个数。</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">样例输入（采用上图中的例子）</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>1 </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>10 </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>8<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>7<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>4<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>2<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>5<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>1<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>9<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>3<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>10<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>6<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">相应的正确输出样例：</SPAN> </P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>1 </SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US>22<SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></P><img src ="http://www.cppblog.com/sopherwenxin/aggbug/2729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sopherwenxin/" target="_blank">sopherwenxin</a> 2006-01-14 18:08 <a href="http://www.cppblog.com/sopherwenxin/archive/2006/01/14/2729.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>李嘉诚的成功秘诀</title><link>http://www.cppblog.com/sopherwenxin/archive/2006/01/11/2567.html</link><dc:creator>sopherwenxin</dc:creator><author>sopherwenxin</author><pubDate>Wed, 11 Jan 2006 07:03:00 GMT</pubDate><guid>http://www.cppblog.com/sopherwenxin/archive/2006/01/11/2567.html</guid><wfw:comment>http://www.cppblog.com/sopherwenxin/comments/2567.html</wfw:comment><comments>http://www.cppblog.com/sopherwenxin/archive/2006/01/11/2567.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/sopherwenxin/comments/commentRss/2567.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/sopherwenxin/services/trackbacks/2567.html</trackback:ping><description><![CDATA[<SPAN class=content>Are You Ready?<BR>——李嘉诚<BR><BR>当你们梦想伟大成功的时候，<BR>你有没有刻苦的准备？<BR>当你们有野心做领袖的时候，<BR>你有没有服务于人的谦恭？<BR>我们常常都想有所获得，<BR>但我们有没有付出的情操？<BR>我们都希望别人听到自己的说话，<BR>我们有没有耐性聆听别人？<BR>每一个人都希望自己快乐，<BR>我们对失落、悲伤的人有没有怜悯？<BR>每一个人都希望站在人前，<BR>但我们是否知道什么时候甘为人后？<BR>你们都知道自己追求什么，<BR>你们知道自己需要什么吗？<BR>我们常常只希望改变别人，<BR>我们知道什么时候改变自己吗？<BR>每一个人都懂得批判别人，<BR>但不是每一个人都知道怎样自我反省。<BR>大家都看重面子，<BR>but do you know honor？<BR>大家都希望拥有财富，<BR>但你知道财富的意义吗？<BR>各位朋友，相信你们都有各种激情，<BR>但你知不知道什么是爱？<BR></SPAN><BR><img src ="http://www.cppblog.com/sopherwenxin/aggbug/2567.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/sopherwenxin/" target="_blank">sopherwenxin</a> 2006-01-11 15:03 <a href="http://www.cppblog.com/sopherwenxin/archive/2006/01/11/2567.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>