﻿<?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++博客-YGFaith-随笔分类-C/C++ &amp; 设计模型</title><link>http://www.cppblog.com/YGFaith/category/9225.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 31 Dec 2008 08:23:52 GMT</lastBuildDate><pubDate>Wed, 31 Dec 2008 08:23:52 GMT</pubDate><ttl>60</ttl><item><title>The Standard C Library </title><link>http://www.cppblog.com/YGFaith/archive/2008/12/31/70846.html</link><dc:creator>YG</dc:creator><author>YG</author><pubDate>Wed, 31 Dec 2008 05:38:00 GMT</pubDate><guid>http://www.cppblog.com/YGFaith/archive/2008/12/31/70846.html</guid><wfw:comment>http://www.cppblog.com/YGFaith/comments/70846.html</wfw:comment><comments>http://www.cppblog.com/YGFaith/archive/2008/12/31/70846.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/YGFaith/comments/commentRss/70846.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/YGFaith/services/trackbacks/70846.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: The Standard C Library --------------经典的基础C的标志库函数是学习和使用C语言的基础,是编写经典C程序的基础,是学习其他计算机知识的基础.C标志库中一共包含了15个头文件:&lt;assert.h&gt; &lt;ctype.h&gt; &lt;stdio.h&gt; &lt;stdlib.h&gt; &lt;string.h&gt; &lt;li...&nbsp;&nbsp;<a href='http://www.cppblog.com/YGFaith/archive/2008/12/31/70846.html'>阅读全文</a><img src ="http://www.cppblog.com/YGFaith/aggbug/70846.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/YGFaith/" target="_blank">YG</a> 2008-12-31 13:38 <a href="http://www.cppblog.com/YGFaith/archive/2008/12/31/70846.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[游戏开发]工厂模式</title><link>http://www.cppblog.com/YGFaith/archive/2008/09/09/61432.html</link><dc:creator>YG</dc:creator><author>YG</author><pubDate>Tue, 09 Sep 2008 15:37:00 GMT</pubDate><guid>http://www.cppblog.com/YGFaith/archive/2008/09/09/61432.html</guid><wfw:comment>http://www.cppblog.com/YGFaith/comments/61432.html</wfw:comment><comments>http://www.cppblog.com/YGFaith/archive/2008/09/09/61432.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/YGFaith/comments/commentRss/61432.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/YGFaith/services/trackbacks/61432.html</trackback:ping><description><![CDATA[<p><span>游戏编程是我业余的爱好，也可以提高对编程的兴趣，每当我有时间的时候就会编写游戏，基于图片的问题所以首选小游戏。这是我毕业后第二款小游戏，相比上一款充分的运用了面向对象的技术，让我享受与不断做类的完善,特别提出的是使用递归技术使得算法更加简洁确实是个很不错的技术,比如：游戏中的地图整行消除判断以及消除。</span></p>
<span>目前的设计情况如下:<br></span>(有写没必要的函数省略了,初次使用UML图)<br><br>此贴主要是想探讨类的设计,标题上写了工厂模式,这里只是简单的把UI创建放到另外一个地方罢了,严格来说应该不算是什么工厂,但是主要是代码<br>易读维护性高就可以了.开发环境：VS2005，WIN32、 C++、DX9<br><br><img src="http://www.cppblog.com/images/cppblog_com/ygfaith/PileUpGame.jpg" border=0><br>如果要增加其他按钮只要继承ImageUI,和实现基类的存虚拟函数就可以。基类的事件触发如下代码。<br>
<div style="PADDING-RIGHT: 5px; PADDING-LEFT: 4px; FONT-SIZE: 13px; BORDER-LEFT-COLOR: rgb(204,204,204); PADDING-BOTTOM: 4px; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BACKGROUND-COLOR: rgb(238,238,238)"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="COLOR: #000000"><br>PUG_BTN_STAT&nbsp;CImageUI::OnEven(UINT&nbsp;msg,&nbsp;WPARAM&nbsp;wParam,&nbsp;LPARAM&nbsp;lParam)<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;POINTS&nbsp;xy;<br>&nbsp;&nbsp;&nbsp;&nbsp;xy&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;MAKEPOINTS(lParam);<br>&nbsp;&nbsp;&nbsp;&nbsp;POINT&nbsp;xy2;<br>&nbsp;&nbsp;&nbsp;&nbsp;xy2.x&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;xy.x;<br>&nbsp;&nbsp;&nbsp;&nbsp;xy2.y&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;xy.y;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">switch</span><span style="COLOR: #000000">(msg)<br>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;WM_MOUSEMOVE:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(PtInRect(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">_displaySize,xy2))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OnPass();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;PASS;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;WM_LBUTTONDOWN:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(PtInRect(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">_displaySize,xy2))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OnClick();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;ONCLICK;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000">&nbsp;WM_LBUTTONUP:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(PtInRect(</span><span style="COLOR: #000000">&amp;</span><span style="COLOR: #000000">_displaySize,xy2))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OnClickOut();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;ONCLICKOUT;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>&nbsp;&nbsp;&nbsp;&nbsp;OnPassOut();<br>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;COMMAND;<br>}<br><br></span></div>
<br>游戏图片如下:<br><img src="http://www.cppblog.com/images/cppblog_com/ygfaith/elsfk1.JPG" border=0><br><br><img src="http://www.cppblog.com/images/cppblog_com/ygfaith/elsfk.JPG" border=0><br><br>游戏下载:<br><a href="http://www.cppblog.com/Files/YGFaith/elsfkGame.rar">/Files/YGFaith/elsfkGame.rar</a> 
<img src ="http://www.cppblog.com/YGFaith/aggbug/61432.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/YGFaith/" target="_blank">YG</a> 2008-09-09 23:37 <a href="http://www.cppblog.com/YGFaith/archive/2008/09/09/61432.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>观察者模式(Subject/Observer) </title><link>http://www.cppblog.com/YGFaith/archive/2008/08/29/60363.html</link><dc:creator>YG</dc:creator><author>YG</author><pubDate>Fri, 29 Aug 2008 07:49:00 GMT</pubDate><guid>http://www.cppblog.com/YGFaith/archive/2008/08/29/60363.html</guid><wfw:comment>http://www.cppblog.com/YGFaith/comments/60363.html</wfw:comment><comments>http://www.cppblog.com/YGFaith/archive/2008/08/29/60363.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cppblog.com/YGFaith/comments/commentRss/60363.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/YGFaith/services/trackbacks/60363.html</trackback:ping><description><![CDATA[<p align=left>定义：对象间的一对多的依赖关系，当一个对象的状态发生改变时，所有依赖于它的对象都得到通知并被自动更新。&nbsp; <br><br>功能：搜索数据库，当有需要公布的数据将其用<span style="COLOR: #000080"><strong>各种方式</strong><span style="COLOR: #000000">发送出去。<br></span></span>&nbsp; <br><strong>观察者模式</strong>无疑能很好的做到上面的要求，无论要多少种方式，只要增加多个继承之ITransfer接口的派生类即可,有很好的维护性。<br><br>以下是实际的应用.<br><br><img src="http://www.cppblog.com/images/cppblog_com/ygfaith/Subject_observer.jpg" border=0><br><br></p>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">接口<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">ITransfer.h</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">#pragma&nbsp;once<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;ITransfer<br><img id=Codehighlighter1_49_174_Open_Image onclick="this.style.display='none'; Codehighlighter1_49_174_Open_Text.style.display='none'; Codehighlighter1_49_174_Closed_Image.style.display='inline'; Codehighlighter1_49_174_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_49_174_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_49_174_Closed_Text.style.display='none'; Codehighlighter1_49_174_Open_Image.style.display='inline'; Codehighlighter1_49_174_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_49_174_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_49_174_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">virtual</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;DoTransfer(...</span><span style="COLOR: #000000">)&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;</span></div>
<br><br>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">FetionTransfer.h<br></span><span style="COLOR: #008000"><span style="COLOR: #000000">#pragma&nbsp;once</span><br>&nbsp;&nbsp; #include "Transfer.h" <br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;CFetionTransfer:</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;ITransfer<br><img id=Codehighlighter1_58_270_Open_Image onclick="this.style.display='none'; Codehighlighter1_58_270_Open_Text.style.display='none'; Codehighlighter1_58_270_Closed_Image.style.display='inline'; Codehighlighter1_58_270_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_58_270_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_58_270_Closed_Text.style.display='none'; Codehighlighter1_58_270_Open_Image.style.display='inline'; Codehighlighter1_58_270_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_58_270_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_58_270_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;CFetionTransfer();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">CFetionTransfer();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;DoTransfer(...);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;......<br></span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;</span></div>
<br><br>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">MailTransfer.h<br><span style="COLOR: #000000">#pragma&nbsp;once</span><br></span><span style="COLOR: #008000">&nbsp;&nbsp; #include "Transfer.h"<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;CMailTransfer:&nbsp;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&nbsp;ITransfer<br><img id=Codehighlighter1_55_264_Open_Image onclick="this.style.display='none'; Codehighlighter1_55_264_Open_Text.style.display='none'; Codehighlighter1_55_264_Closed_Image.style.display='inline'; Codehighlighter1_55_264_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_55_264_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_55_264_Closed_Text.style.display='none'; Codehighlighter1_55_264_Open_Image.style.display='inline'; Codehighlighter1_55_264_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_55_264_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_55_264_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;CMailTransfer();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">CMailTransfer();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&nbsp;DoTransfer(...);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>....<br></span><span style="COLOR: #000000"><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;</span></div>
<br><br>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">TransferPool.h</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">#pragma&nbsp;once<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Transfer.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>#include&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000">&nbsp;std;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&nbsp;CTransferPool<br><img id=Codehighlighter1_113_369_Open_Image onclick="this.style.display='none'; Codehighlighter1_113_369_Open_Text.style.display='none'; Codehighlighter1_113_369_Closed_Image.style.display='inline'; Codehighlighter1_113_369_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_113_369_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_113_369_Closed_Text.style.display='none'; Codehighlighter1_113_369_Open_Image.style.display='inline'; Codehighlighter1_113_369_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_113_369_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_113_369_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ITransfer</span><span style="COLOR: #000000">*&gt;</span><span style="COLOR: #000000">&nbsp;vo;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">:<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">virtual</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">CTransferPool();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;Login(ITransfer</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;po);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;Logout(ITransfer</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;po);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">向各成员广播消息</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;Notify(</span><span style="COLOR: #0000ff">...</span><span style="COLOR: #000000">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">;</span></div>
<br>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #008000">//</span><span style="COLOR: #008000">TransferPool.cpp</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">#include&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">TransferPool.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top>CTransferPool::</span><span style="COLOR: #000000">~</span><span style="COLOR: #000000">CTransferPool()<br><img id=Codehighlighter1_78_195_Open_Image onclick="this.style.display='none'; Codehighlighter1_78_195_Open_Text.style.display='none'; Codehighlighter1_78_195_Closed_Image.style.display='inline'; Codehighlighter1_78_195_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_78_195_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_78_195_Closed_Text.style.display='none'; Codehighlighter1_78_195_Open_Image.style.display='inline'; Codehighlighter1_78_195_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_78_195_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_78_195_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ITransfer</span><span style="COLOR: #000000">*&gt;</span><span style="COLOR: #000000">::iterator&nbsp;vi&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;vo.begin();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(;&nbsp;vi&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;vo.end();&nbsp;vi</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_167_193_Open_Image onclick="this.style.display='none'; Codehighlighter1_167_193_Open_Text.style.display='none'; Codehighlighter1_167_193_Closed_Image.style.display='inline'; Codehighlighter1_167_193_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_167_193_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_167_193_Closed_Text.style.display='none'; Codehighlighter1_167_193_Open_Image.style.display='inline'; Codehighlighter1_167_193_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_167_193_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_167_193_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;if(*vi)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delete *vi;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *vi = NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CTransferPool::Login(ITransfer</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;po)<br><img id=Codehighlighter1_239_263_Open_Image onclick="this.style.display='none'; Codehighlighter1_239_263_Open_Text.style.display='none'; Codehighlighter1_239_263_Closed_Image.style.display='inline'; Codehighlighter1_239_263_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_239_263_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_239_263_Closed_Text.style.display='none'; Codehighlighter1_239_263_Open_Image.style.display='inline'; Codehighlighter1_239_263_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_239_263_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_239_263_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vo.push_back(po);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CTransferPool::Logout(ITransfer</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;po)<br><img id=Codehighlighter1_308_454_Open_Image onclick="this.style.display='none'; Codehighlighter1_308_454_Open_Text.style.display='none'; Codehighlighter1_308_454_Closed_Image.style.display='inline'; Codehighlighter1_308_454_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_308_454_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_308_454_Closed_Text.style.display='none'; Codehighlighter1_308_454_Open_Image.style.display='inline'; Codehighlighter1_308_454_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_308_454_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_308_454_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ITransfer</span><span style="COLOR: #000000">*&gt;</span><span style="COLOR: #000000">::iterator&nbsp;vi&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;vo.begin();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(;&nbsp;vi&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;vo.end();&nbsp;vi</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_397_452_Open_Image onclick="this.style.display='none'; Codehighlighter1_397_452_Open_Text.style.display='none'; Codehighlighter1_397_452_Closed_Image.style.display='inline'; Codehighlighter1_397_452_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_397_452_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_397_452_Closed_Text.style.display='none'; Codehighlighter1_397_452_Open_Image.style.display='inline'; Codehighlighter1_397_452_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_397_452_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_397_452_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">vi&nbsp;</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">&nbsp;po)<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vo.erase(vi);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;CTransferPool::Notify(</span><span style="COLOR: #0000ff">...</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_568_766_Open_Image onclick="this.style.display='none'; Codehighlighter1_568_766_Open_Text.style.display='none'; Codehighlighter1_568_766_Closed_Image.style.display='inline'; Codehighlighter1_568_766_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_568_766_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_568_766_Closed_Text.style.display='none'; Codehighlighter1_568_766_Open_Image.style.display='inline'; Codehighlighter1_568_766_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_568_766_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_568_766_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vector</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">ITransfer</span><span style="COLOR: #000000">*&gt;</span><span style="COLOR: #000000">::iterator&nbsp;vi&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;vo.begin();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">&nbsp;(;&nbsp;vi&nbsp;</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">&nbsp;vo.end();&nbsp;vi</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_657_764_Open_Image onclick="this.style.display='none'; Codehighlighter1_657_764_Open_Text.style.display='none'; Codehighlighter1_657_764_Closed_Image.style.display='inline'; Codehighlighter1_657_764_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_657_764_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_657_764_Closed_Text.style.display='none'; Codehighlighter1_657_764_Open_Image.style.display='inline'; Codehighlighter1_657_764_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_657_764_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_657_764_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ITransfer&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">s&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">vi;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">vi)</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">DoTransfer(...);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
<br>
<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"><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;main<br><img id=Codehighlighter1_11_475_Open_Image onclick="this.style.display='none'; Codehighlighter1_11_475_Open_Text.style.display='none'; Codehighlighter1_11_475_Closed_Image.style.display='inline'; Codehighlighter1_11_475_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_11_475_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_11_475_Closed_Text.style.display='none'; Codehighlighter1_11_475_Open_Image.style.display='inline'; Codehighlighter1_11_475_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_11_475_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_11_475_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;CTransferPool</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">m_pTranPool</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;CTransferPool();<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;CFetionTransfer&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">m_pFetionTran&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;CFetionTransfer(...);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;CMailTransfer&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">m_pMailTran&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&nbsp;CMailTransfer(...);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;m_pTranPool</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Login(m_pFetionTran);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;m_pTranPool</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Login(m_pMailTran);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(需要发送消息)<br><img id=Codehighlighter1_295_343_Open_Image onclick="this.style.display='none'; Codehighlighter1_295_343_Open_Text.style.display='none'; Codehighlighter1_295_343_Closed_Image.style.display='inline'; Codehighlighter1_295_343_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_295_343_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_295_343_Closed_Text.style.display='none'; Codehighlighter1_295_343_Open_Image.style.display='inline'; Codehighlighter1_295_343_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_295_343_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_295_343_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_pTranPool</span><span style="COLOR: #000000">-&gt;</span><span style="COLOR: #000000">Notify(<img src="http://www.cppblog.com/Images/dot.gif">);<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">释放</span><span style="COLOR: #008000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(m_pTranPool)<br><img id=Codehighlighter1_393_463_Open_Image onclick="this.style.display='none'; Codehighlighter1_393_463_Open_Text.style.display='none'; Codehighlighter1_393_463_Closed_Image.style.display='inline'; Codehighlighter1_393_463_Closed_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_393_463_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_393_463_Closed_Text.style.display='none'; Codehighlighter1_393_463_Open_Image.style.display='inline'; Codehighlighter1_393_463_Open_Text.style.display='inline';" src="http://www.cppblog.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id=Codehighlighter1_393_463_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.cppblog.com/Images/dot.gif"></span><span id=Codehighlighter1_393_463_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete&nbsp;m_pTranPool;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_pTranPool&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;NULL;<br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="COLOR: #000000"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/InBlock.gif" align=top><img src="http://www.cppblog.com/Images/dot.gif"><img src="http://www.cppblog.com/Images/dot.gif"><img src="http://www.cppblog.com/Images/dot.gif"><br><img src="http://www.cppblog.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div>
<img src ="http://www.cppblog.com/YGFaith/aggbug/60363.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/YGFaith/" target="_blank">YG</a> 2008-08-29 15:49 <a href="http://www.cppblog.com/YGFaith/archive/2008/08/29/60363.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>求两个数中最大值，不用判断语句。</title><link>http://www.cppblog.com/YGFaith/archive/2008/08/21/59524.html</link><dc:creator>YG</dc:creator><author>YG</author><pubDate>Thu, 21 Aug 2008 06:20:00 GMT</pubDate><guid>http://www.cppblog.com/YGFaith/archive/2008/08/21/59524.html</guid><wfw:comment>http://www.cppblog.com/YGFaith/comments/59524.html</wfw:comment><comments>http://www.cppblog.com/YGFaith/archive/2008/08/21/59524.html#Feedback</comments><slash:comments>11</slash:comments><wfw:commentRss>http://www.cppblog.com/YGFaith/comments/commentRss/59524.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/YGFaith/services/trackbacks/59524.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<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: #000000">#include&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">iostream.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;<br>#include&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">math.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;<br><br></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000">&nbsp;bits&nbsp;(&nbsp;sizeof(&nbsp;int&nbsp;)&nbsp;*&nbsp;8&nbsp;-&nbsp;1&nbsp;)&nbsp;</span><span style="COLOR: #000000"><br></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;CheckFlag(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;y&nbsp;)&nbsp;&nbsp;<br>{&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;s1&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;x&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;bits;&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;s2&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;y&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;bits;&nbsp;&nbsp;<br>s1</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">abs(s1);&nbsp;<br>s2</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">abs(s2);&nbsp;<br></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(&nbsp;s1&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;s2&nbsp;);&nbsp;&nbsp;<br>}&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;SameSign(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Flag,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;y&nbsp;)&nbsp;<br>{&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;t[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;{&nbsp;x,&nbsp;y&nbsp;};&nbsp;<br></span><span style="COLOR: #0000ff">long</span><span style="COLOR: #000000">&nbsp;z&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;x&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;y;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;s&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;z&nbsp;</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">&nbsp;(bits</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">32</span><span style="COLOR: #000000">);&nbsp;&nbsp;<br>s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">abs(s);&nbsp;<br></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;t[s];&nbsp;<br>}&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;DiffSign(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Flag,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;y)&nbsp;比较&nbsp;<br>{&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;t[</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;{&nbsp;x,&nbsp;y&nbsp;};&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;t[Flag&nbsp;</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">];&nbsp;<br>}&nbsp;<br></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">FuncList[</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">])(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Flag,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;y)</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">{SameSign,&nbsp;DiffSign,&nbsp;DiffSign,&nbsp;SameSign};&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Max(&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,&nbsp;</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;y&nbsp;)&nbsp;&nbsp;<br>{&nbsp;&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;Flag&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;CheckFlag(&nbsp;x,&nbsp;y&nbsp;);&nbsp;&nbsp;<br><br></span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&nbsp;(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">FuncList[Flag])(Flag,x,y);&nbsp;&nbsp;<br>}&nbsp;<br></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&nbsp;main()&nbsp;&nbsp;<br>{&nbsp;<br></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;x,y,z;&nbsp;<br>cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">请输入整型x的值(-32768~32767):</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;&nbsp;<br>cin</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">x;&nbsp;<br>cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">请输入整型y的值(-32768~32767):</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;&nbsp;<br>cin</span><span style="COLOR: #000000">&gt;&gt;</span><span style="COLOR: #000000">y;&nbsp;<br>z</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Max(x,y);&nbsp;<br>cout</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">最大的数:</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">z</span><span style="COLOR: #000000">&lt;&lt;</span><span style="COLOR: #000000">endl;&nbsp;<br>}&nbsp;&nbsp;<br><br></span></div>
<br><br>#define&nbsp;bits&nbsp;(&nbsp;sizeof(&nbsp;int&nbsp;)&nbsp;*&nbsp;8&nbsp;-&nbsp;1&nbsp;)&nbsp;//移动的位数 <br>static&nbsp;int&nbsp;SameSign(&nbsp;int&nbsp;Flag,&nbsp;int&nbsp;x,&nbsp;int&nbsp;y&nbsp;)&nbsp;//函数功能:x,y同号时的比较 <br>static&nbsp;int&nbsp;DiffSign(int&nbsp;Flag,int&nbsp;x,int&nbsp;y)&nbsp;//函数功能:x,y异号时的比较 <br>static&nbsp;int&nbsp;(*FuncList[4])(int&nbsp;Flag,int&nbsp;x,int&nbsp;y)={SameSign,&nbsp;DiffSign,&nbsp;DiffSign,&nbsp;SameSign};&nbsp;//定义函数指针数组 <br>static&nbsp;int&nbsp;Max(&nbsp;int&nbsp;x,&nbsp;int&nbsp;y&nbsp;)&nbsp;//函数功能:求最大值 <br><br>static&nbsp;int&nbsp;CheckFlag(&nbsp;int&nbsp;x,&nbsp;int&nbsp;y&nbsp;)&nbsp;//函数功能:检测x,y的符号 <br>/* <br>Ｆlag&nbsp;的值 <br>+&nbsp;+:0 <br>-&nbsp;+;1 <br>+&nbsp;1:2 <br>-&nbsp;-:3 <br>*/ 
<img src ="http://www.cppblog.com/YGFaith/aggbug/59524.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/YGFaith/" target="_blank">YG</a> 2008-08-21 14:20 <a href="http://www.cppblog.com/YGFaith/archive/2008/08/21/59524.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>