<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>苏洋博客 &#187; C &amp; C++</title>
	<atom:link href="http://promiseforever.com/topics/learning/c-learning/feed" rel="self" type="application/rss+xml" />
	<link>http://promiseforever.com</link>
	<description>记录我的一点一滴。</description>
	<lastBuildDate>Sat, 12 May 2012 12:37:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>[转]命名空间的使用</title>
		<link>http://promiseforever.com/2012/05/11/%e8%bd%ac%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e4%bd%bf%e7%94%a8.html</link>
		<comments>http://promiseforever.com/2012/05/11/%e8%bd%ac%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e4%bd%bf%e7%94%a8.html#comments</comments>
		<pubDate>Fri, 11 May 2012 15:10:26 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[JAVASCRIPT]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[命名空间]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=6694</guid>
		<description><![CDATA[关于命名空间. 来源:http://www.cnblogs.com/anytao/archive/2010/10/22/anytao-devstory-15-use-namespace-in-js.html Introduction How to have a better code organization? When your software become bigger and bigger, the code will torture you all the time. So, the smart guy innovate the Namespace to handle this issue. For example, in .NET world, we define the class in scope of namespace: namespace Anytao.Common &#123; public class Console ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2012/05/11/%e8%bd%ac%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4%e7%9a%84%e4%bd%bf%e7%94%a8.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[javascript]排序算法-快速排序</title>
		<link>http://promiseforever.com/2012/03/03/javascript%e6%8e%92%e5%ba%8f%e7%ae%97%e6%b3%95-%e5%bf%ab%e9%80%9f%e6%8e%92%e5%ba%8f.html</link>
		<comments>http://promiseforever.com/2012/03/03/javascript%e6%8e%92%e5%ba%8f%e7%ae%97%e6%b3%95-%e5%bf%ab%e9%80%9f%e6%8e%92%e5%ba%8f.html#comments</comments>
		<pubDate>Fri, 02 Mar 2012 23:09:08 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[快速排序]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=6179</guid>
		<description><![CDATA[排序算法：快速排序 原文出处. 快速排序采用的思想是分治思想。 快速排序是找出一个元素（理论上可以随便找一个）作为基准(pivot),然后对数组进行分区操作,使基准左边元素的值都不大于基准值,基准右边的元素值 都不小于基准值，如此作为基准的元素调整到排序后的正确位置。递归快速排序，将其他n-1个元素也调整到排序后的正确位置。最后每个元素都是在排序后的正 确位置，排序完成。所以快速排序算法的核心算法是分区操作，即如何调整基准的位置以及调整返回基准的最终位置以便分治递归。 举例说明一下吧，这个可能不是太好理解。假设要排序的序列为 2 2 4 9 3 6 7 1 5 首先用2当作基准，使用i j两个指针分别从两边进行扫描，把比2小的元素和比2大的元素分开。首先比较2和5，5比2大，j左移 2 2 4 9 3 6 7 1 5 比较2和1，1小于2，所以把1放在2的位置 2 1 4 9 3 6 7 1 5 比较2和4，4大于2，因此将4移动到后面 2 1 4 9 3 6 7 4 5 比较2和7，2和6，2和3，2和9，全部大于2，满足条件，因此不变 经过第一轮的快速排序，元素变为下面的样子 [1] 2 [4 9 3 6 ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2012/03/03/javascript%e6%8e%92%e5%ba%8f%e7%ae%97%e6%b3%95-%e5%bf%ab%e9%80%9f%e6%8e%92%e5%ba%8f.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C++任意进制转换</title>
		<link>http://promiseforever.com/2012/02/24/c%e4%bb%bb%e6%84%8f%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2.html</link>
		<comments>http://promiseforever.com/2012/02/24/c%e4%bb%bb%e6%84%8f%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2.html#comments</comments>
		<pubDate>Fri, 24 Feb 2012 03:28:52 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[进制转换]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=6111</guid>
		<description><![CDATA[&#160; #include&#60;iostream&#62; #include&#60;string&#62; using namespace std; &#160; //将一个string倒置 void reverse&#40;string &#38;a&#41; &#123; char temp; for&#40;int i=0; i&#60;=&#40;a.size&#40;&#41;-2&#41;/2; i++&#41; &#123; temp=a&#91;i&#93;; a&#91;i&#93;=a&#91;a.size&#40;&#41;-i-1&#93;; a&#91;a.size&#40;&#41;-i-1&#93;=temp; &#125; &#125; &#160; //默认s1为正序，s2为正序，【2－36任意进制转化】 string NtoN&#40;string s1,long base1,long base2&#41; &#123; string s2; long sum=0,yushu; string::iterator it; it=s1.begin&#40;&#41;; while&#40;it!=s1.end&#40;&#41;&#41; &#123; sum*=base1; if&#40;*it&#60;='9' &#38;&#38; *it&#62;='0'&#41; sum+= *it-'0'; else sum+= *it+10-'A'; *it++; &#125; cout&#60;&#60;&#34;sum(decimal):&#34;&#60;&#60;sum&#60;&#60;endl; while&#40;sum!=0&#41; &#123; ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2012/02/24/c%e4%bb%bb%e6%84%8f%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>一道趣味题</title>
		<link>http://promiseforever.com/2012/01/10/%e4%b8%80%e9%81%93%e8%b6%a3%e5%91%b3%e9%a2%98.html</link>
		<comments>http://promiseforever.com/2012/01/10/%e4%b8%80%e9%81%93%e8%b6%a3%e5%91%b3%e9%a2%98.html#comments</comments>
		<pubDate>Tue, 10 Jan 2012 07:05:42 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[升级]]></category>
		<category><![CDATA[屠龙刀]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=5037</guid>
		<description><![CDATA[刚刚看到了一道题. 一把1级屠龙刀，最高可以升到9级，每次升级成功率30%，失败率70%。失败会退一级，最差退到1级。 那么在1000次内升级到9级的概率为多少？ 尝试写了一个php的模拟,第一次没设定失败下限.结果很给力. 第994次升级结果:屠龙刀等级为:-358! 第995次升级结果:屠龙刀等级为:-359! 第996次升级结果:屠龙刀等级为:-358! 第997次升级结果:屠龙刀等级为:-359! 第998次升级结果:屠龙刀等级为:-360! 第999次升级结果:屠龙刀等级为:-361! 后来运气好了一次. 第342次升级结果:屠龙刀等级为:7!最高等级为7 第343次升级结果:屠龙刀等级为:8!最高等级为8 第344次升级结果:屠龙刀等级为:9!最高等级为9 坑爹九级神器！ 代码如下，群里有个大大的高端代码，我也留下来。 &#60;?php &#160; $Updateresultabby = array&#40; array&#40; 'return' =&#62; -1, 'range' =&#62; '70' &#41;, array&#40; 'return' =&#62; 1, 'range' =&#62; '30' &#41; &#41;; &#160; $level =1 ; $level_max =2; &#160; for&#40; $i = 0; $i &#60; 2000; $i++ &#41;&#123; &#160; ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2012/01/10/%e4%b8%80%e9%81%93%e8%b6%a3%e5%91%b3%e9%a2%98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[C++]VS2010中C++第一个陷阱</title>
		<link>http://promiseforever.com/2011/10/11/cvs2010%e4%b8%adc%e7%ac%ac%e4%b8%80%e4%b8%aa%e9%99%b7%e9%98%b1.html</link>
		<comments>http://promiseforever.com/2011/10/11/cvs2010%e4%b8%adc%e7%ac%ac%e4%b8%80%e4%b8%aa%e9%99%b7%e9%98%b1.html#comments</comments>
		<pubDate>Tue, 11 Oct 2011 12:17:37 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[isdigit]]></category>
		<category><![CDATA[死循环]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=4612</guid>
		<description><![CDATA[string number1,number2; std::cout&#60;&#60;tip&#91;0&#93;&#60;&#60;&#34;\n&#34;&#60;&#60;tip&#91;1&#93;&#60;&#60;std::endl; std::cin&#62;&#62;number1; &#160; while&#40;!isdigit&#40;number1&#41;&#41;&#123; std::cout&#60;&#60;tip&#91;5&#93;&#60;&#60;std::endl; std::cin&#62;&#62;number1; &#125; &#160; std::cout&#60;&#60;tip&#91;2&#93;&#60;&#60;std::endl 大概就是这个过程吧,会出现神马情况呢,如果cin接受的用户输入不是0~9而是其他呢. 我觉得木有亲手打过的童鞋100%说,循环判断是不是数字,不是就停下来等用户输入下一次. 那么好,扔VS里调试下吧.结果呢,无限循环吧.. 原因 是什么呢.这里很明显嘛,为什么会循环,while嘛,为什么while会死循环,!isdigit(number1)成立.. 所以呢,number1,也就是从cin传递来的用户输入有问题. 有什么问题呢. typeid(number1).name(); 后得到一个反馈..嗯.char类型.. 那么如何解决呢? 我觉得加段小函数检查就可以了.. bool IsNumber&#40;string s&#41;&#123; const char *tmp = s.c_str&#40;&#41;; for&#40;int i =0;i&#60;s.length&#40;&#41;;i++&#41; &#123; if &#40;tmp&#91;i&#93;&#62;57&#124;&#124;tmp&#91;i&#93;&#60;48&#41; return false; &#125; return true; &#125;]]></description>
		<wfw:commentRss>http://promiseforever.com/2011/10/11/cvs2010%e4%b8%adc%e7%ac%ac%e4%b8%80%e4%b8%aa%e9%99%b7%e9%98%b1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[我的总结]关于ROUND函数的BUG</title>
		<link>http://promiseforever.com/2009/07/15/bug-round.html</link>
		<comments>http://promiseforever.com/2009/07/15/bug-round.html#comments</comments>
		<pubDate>Wed, 15 Jul 2009 00:21:29 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[我的总结]]></category>
		<category><![CDATA[BUG]]></category>
		<category><![CDATA[ROUND]]></category>
		<category><![CDATA[函数]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=2055</guid>
		<description><![CDATA[ROUND函数在很多语言中都存在，它的“bug”也威名远播&#8230; 关于它的舍入问题，很多人都总结过吧，四舍六入五成双。 文章包含代码以及一些引用资料，如果感兴趣，可以选择阅读全文。 以下资料来自CSDN 以及黄海blog ROUND函数在很多语言中都存在，它的“bug”也威名远播&#8230; 关于它的舍入问题，很多人都总结过吧，四舍六入五成双。 文章包含代码以及一些引用资料，如果感兴趣，可以选择阅读全文。 以下资料来自CSDN 以及黄海blog 其实财务函数的它主要是进行一种平衡算法。 正如一位朋友所言 ， “VBA中的Round函数不是Bug，而只是一种特殊算法（银行业算法）。 简单地说就是向最近的偶数位舍入。 如：Round(3.375,2)==Round(3.385,2)==3.38” 下面的这个函数（算术四舍五入平衡算法）考虑了负数的处理改编自微软文档，可以用于财务系统开发： Function SARound(ByVal X As Currency, Optional ByVal Factor As Long = 2) As Currency SARound = Fix(X * 10 ^ Factor + Sgn(X) * 0.5) / 10 ^ Factor End Function 如果把Fix变为Int就成为不平衡算法。 MS文档原文： http://support.microsoft.com/default.aspx?scid=kb;en-us;196652 &#160; Public Function RoundToLarger(dblInput ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2009/07/15/bug-round.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[C]Hello World 也疯狂</title>
		<link>http://promiseforever.com/2009/06/06/c-crazy-hello-world.html</link>
		<comments>http://promiseforever.com/2009/06/06/c-crazy-hello-world.html#comments</comments>
		<pubDate>Sat, 06 Jun 2009 14:00:43 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[HELLO WORLD]]></category>
		<category><![CDATA[经典]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=1899</guid>
		<description><![CDATA[原文出处：http://www.baiba.net/blog/?action=show&#38;id=61
这篇不收录过来实在是...对不起自己...嘿嘿~
都在Dev-C++里跑了一遍。

[c]
#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;

int main(int argc, char *argv[])
{
int x=0,y[14],*z=&#38;y;
*(z++)=0x48;
*(z++)=y[x++]+0x1D;
*(z++)=y[x++...]]></description>
		<wfw:commentRss>http://promiseforever.com/2009/06/06/c-crazy-hello-world.html/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>[C]基础题练习10道</title>
		<link>http://promiseforever.com/2009/06/05/c-start-1.html</link>
		<comments>http://promiseforever.com/2009/06/05/c-start-1.html#comments</comments>
		<pubDate>Fri, 05 Jun 2009 07:10:05 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[练习题]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=1867</guid>
		<description><![CDATA[看的唯C论坛的电子书了..手痒,把10道题都练下吧。

[c]

/* 题目：有1、2、3、4个数字，能组成多少个互不相同且无重复数字的三位数？都是多少？*/
#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;

int main(int argc, char *argv[])
{
int i,j,k,t;
t=0;
printf(&#34;无重复3位数如下：
&#34;);
for(...]]></description>
		<wfw:commentRss>http://promiseforever.com/2009/06/05/c-start-1.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[MFC]消息机制</title>
		<link>http://promiseforever.com/2009/05/16/mfc-message.html</link>
		<comments>http://promiseforever.com/2009/05/16/mfc-message.html#comments</comments>
		<pubDate>Sat, 16 May 2009 07:15:01 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[WIN32]]></category>
		<category><![CDATA[经典资料]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[机制]]></category>
		<category><![CDATA[消息]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=1498</guid>
		<description><![CDATA[MFC剖析：消息机制 出处：白云黄鹤 转载的一篇老文，有的放矢的说明了MFC消息流程。 首先,让我们看一下MFC的消息循环部分：（程序取自MFC源程序，由于篇幅，我删去了一些非重要的部分。） MFC的WinMain函数： extern &#34;C&#34; int WINAPI _tWinMain&#40;HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow&#41; &#123; // call shared/exported WinMain return AfxWinMain&#40;hInstance, hPrevInstance, lpCmdLine, nCmdShow&#41;; &#125; &#160; int AFXAPI AfxWinMain &#40;HINSTANCE hInstance, HINSTANCE hPrevInstance, &#160; LPTSTR lpCmdLine, int nCmdShow&#41; &#123; int nReturnCode = -1; CWinApp* pApp = AfxGetApp&#40;&#41;; &#160; // ...... &#160; // ...]]></description>
		<wfw:commentRss>http://promiseforever.com/2009/05/16/mfc-message.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>[C++]用 QueryPerformanceFrequency 和 QueryPerformanceCounter 进行高精度计时</title>
		<link>http://promiseforever.com/2009/04/23/c-queryperformancecounter-queryperformancefrequency.html</link>
		<comments>http://promiseforever.com/2009/04/23/c-queryperformancecounter-queryperformancefrequency.html#comments</comments>
		<pubDate>Thu, 23 Apr 2009 02:14:20 +0000</pubDate>
		<dc:creator>苏洋</dc:creator>
				<category><![CDATA[C & C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[QueryPerformanceCounter]]></category>
		<category><![CDATA[QueryPerformanceFrequency]]></category>
		<category><![CDATA[高精度计时]]></category>

		<guid isPermaLink="false">http://promiseforever.com/?p=361</guid>
		<description><![CDATA[[C++]用 QueryPerformanceFrequency 和 QueryPerformanceCounter 进行高精度计时
http://www.cppblog.com/bidepan2023/archive/2008/01/22/41627.html

C++代码

    void&#160;main()&#160;{&#160;&#160;&#160;&#160; &#160;&#160;
    &#160;&#160;&#160;&#160;LARGE_INTEGER&#160;lv; &#160;&#160;
    &#160;&#038;nb...]]></description>
		<wfw:commentRss>http://promiseforever.com/2009/04/23/c-queryperformancecounter-queryperformancefrequency.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

