<?xml version="1.0" encoding="utf-8"?><rss version="2.0">
<channel>
<title><![CDATA[我思故我在]]></title>
<link>http://blog.pfan.cn/soliddream</link>
<description>编程爱好者博客</description>
<language>zh-cn</language>
			<item>
		<title><![CDATA[体验Vista]]></title>
		<link>http://blog.pfan.cn/soliddream/33243.html</link>
		<description><![CDATA[&nbsp; 新买了台本本,预装Vista Home Premium操作系统。
&nbsp;
&nbsp; Vista操作系统发行以来，大家议论纷纷，褒贬不一。好的地方呢，备受微软吹捧的使用半透明效果和闪耀前进条的Aero界面，系统还原功能强大而又操作简单，安全性能提高。坏的地方在于系统，体格臃肿，对内存、显卡的消耗是巨大的。对此许多网民说爱你不容易，而将目光放在了其它操作系统，诸如苹果的Mac OS X ，免费的Ubuntu(Linux)都是不错的选择，微型计算机杂志近期都作过相关介绍。有机会我很想体验一下上述两款操作系统。
&nbsp;
&nbsp; OK，拉入正题，由于本本的操作系统是英文版的，第一步要做的就是对中文的支持。如果操作系统是中文版的可以跳过这一部分。这些有关配置均在Control Panel的Regional and language Options。Formats选项卡的Current format选择Chinese(RPC)，Location选项卡的Current Location中选择China ，keyboards and Language选项卡点击Change keyboards, 添加中文键盘，Administrative选项卡中点击Change system locale,在Current system locale选择Chinese(RPC) 意思是乱码的时候选择中文解码。
&nbsp;
&nbsp; 其次是上网，由于笔者选择的是电信宽带，如果读者使用的是其它宽带，可以跳过这一部分。我且假设万事俱备，只欠东风的情况，即网线已经接入，仅需配置好电脑就可以上网的情况。只要用过电信宽带的用户，都知道星空极速这个软件，在Windows XP操作系统中是通过这个软件来拨号上网的，但如果安装到Vista操作系统中，拨号会有错误734提示，按照建议重装网卡驱动，问题依旧。而且本地连接也会显示受限连接，其实Vista操作系统不需要星空极速，通过新建PPPOE宽带连接设置好用户名和密码即可上网。上网后更新一下Windows system，杀毒软件以及其它系统自带软件的更新，这且不提。
&nbsp;
&nbsp; 然后就是硬盘分区了，我的本本硬盘250G，刚拿来的时候，C盘220G，D盘12.3G（放满了还原系统的文件），有必要从C盘]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2008-03-09 00:45:00</pubDate>
		</item>
				<item>
		<title><![CDATA[找工作的门槛：数据结构]]></title>
		<link>http://blog.pfan.cn/soliddream/33144.html</link>
		<description><![CDATA[以下收集找工作时遇到的有关数据结构的问题，并逐步扩充中1、&nbsp;Q:都有哪些查找算法？A:最简单的方法是顺序查找：从第一个位置开始，持续地向后查找，直到找到这个项或是到达数组的末尾。
  如果查找对象是有序的，可采用折半查找。]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2008-03-03 16:16:00</pubDate>
		</item>
				<item>
		<title><![CDATA[子包和基础包之类的习题]]></title>
		<link>http://blog.pfan.cn/soliddream/31611.html</link>
		<description><![CDATA[题目：创建一个名为child的子包，其基础包名为parent。 子包中应该包含一个Location类。Location类包含一个名为disp()的方法，用于显示“child子包中的Location类”的消息。创建一个名为ParentTest的类，使它导入此子包，并调用Location类的disp()方法。
&nbsp;
答案：
1、创建文件目录 parent\child ，创建Location.java文件
package parent.child;
public class Location{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public void disp(){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("child子包中的Location类");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
}
2、在parent同一层创建ParentTest.java文件
import parent.child.Location;
&nbsp;
public class ParentTest{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void main(String []args){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Location log=new Location();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.disp();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;
}
3、运行键入cmd,在]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2007-12-27 00:30:00</pubDate>
		</item>
				<item>
		<title><![CDATA[解决条纹级次的实验程序]]></title>
		<link>http://blog.pfan.cn/soliddream/24942.html</link>
		<description><![CDATA[//---------------main------------------------&nbsp;&nbsp;#include&nbsp;&lt;vector&gt;&nbsp;&nbsp;#include&nbsp;&lt;iostream&gt;&nbsp;&nbsp;#include&nbsp;"spline3.h"&nbsp;&nbsp;#include&nbsp;&lt;fstream&gt;&nbsp;&nbsp;#include&nbsp;"math.h"&nbsp;&nbsp;&nbsp;#include&nbsp;"FringeOrder.h"&nbsp;&nbsp;using&nbsp;namespace&nbsp;std;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;main()&nbsp;&nbsp;{&nbsp;int&nbsp;n,m,i,j;&nbsp;&nbsp;&nbsp;&nbsp;double&nbsp;u,s;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;double&nbsp;x[512],y[512],dy[512],ddy[512];&nbsp;&nbsp;&nbsp;//&nbsp;static&nbsp;double&nbsp;t[36],z[36],dz[36],ddz[36];&nbsp;&nbsp;&nbsp;&nbsp;Spline3&nbsp;info;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(i=0;i&lt;512;i++)&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x[i]=i;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y[i]=sin(5*3.1415926*x[i]/512);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;info.readinto(x[i],y[i],0,0);&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;//for&nbsp;(i=0;i]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2007-04-16 22:11:00</pubDate>
		</item>
				<item>
		<title><![CDATA[一般矩阵变换行最简形矩阵]]></title>
		<link>http://blog.pfan.cn/soliddream/22572.html</link>
		<description><![CDATA[function a=SimpleMatrix(x)%对矩阵实行初等行变换，，化为行最简形矩阵，其特点是：非零行的第一个非零元为1，且这些非零元所在的列的其他元素都为0%x=rand(100);object=x;[m,n]=size(object);for i=1:m&nbsp; &nbsp; temp(1:m,1)=object(1:m,i);&nbsp; &nbsp; if( all(abs(temp(i:m,1))&lt;eps))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;continue;&nbsp; &nbsp; end&nbsp; &nbsp; N_zero=find(temp);&nbsp; &nbsp; clear temp;&nbsp; &nbsp; [p,q]=size(N_zero);&nbsp; &nbsp; clear Modulus;&nbsp; &nbsp; if( all(abs(object(i,1:n))&lt;10e-10))&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;continue;&nbsp; &nbsp; end&nbsp; &nbsp; z=1;&nbsp; &nbsp; for j=1:p&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;T_M=object(N_zero(j,1),i)/object(N_zero(i,1),i);&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if z==1&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Modulus=T_M;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;z=z+1;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;continue;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Modulus=[Modulus,T_M];&nbsp; &nbsp;&nbs]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2007-01-14 18:37:00</pubDate>
		</item>
				<item>
		<title><![CDATA[利用maltab解决桌球问题]]></title>
		<link>http://blog.pfan.cn/soliddream/21507.html</link>
		<description><![CDATA[利用MatLab解决桌球射击方位角问题
&nbsp;&nbsp;有2个球置于矩形板之上，一个用来做射击球，另一个则是作为目标图，现在考虑的问题是，如何设置射击球的方向，从而撞击目标球，使之进入矩形板的四个角点。可以利用矩形边的反弹，忽略摩擦。
这个问题其实就是桌球射击的理想化的简化版。由于没有摩擦，所以碰撞之后，目标球的行进方向将沿着射击球球心到目标球的球心的射线方向，并且由于没有摩擦，将不需要考虑速度这个概念。简化起见，规定目标球不经过矩形边的反弹直接进洞，而射击球最多只能利用矩形边的反弹1次，我不太了解桌球上的规则如何，但我想这种简化大约也符合普通桌球玩家考虑的瞄准原则吧。
以下涉及到的角度都是以平面直线逆时针旋转与之重合所转的角度，我是这样考虑这个问题的，先从射击球考虑，目标球射入矩形板的四个角洞有四个角度，对于每一个角度，射击球都有一个确定的碰撞，即沿着射击球进洞方向的反方向，换句话说在碰撞一刹那，射击球的球心是确定的，射击球包括原位置，与矩形四条边的映射位置共有5个球心与该球心连成一条射线（该射线方向即射击球瞄准方向），然而还有个限制条件，即射击球只能撞击圆心与目标球两条切线所夹的范围，这样就需要5个镜像点与4个撞击点所连的射线是否符合该限制条件，符合的话就是我们可以瞄准的方向了。
主程序
a=input('第一个球的x坐标');
b=input('第一个球的y坐标');
r1=input('第一个球的半径');
c=input('第二个球的x坐标');
d=input('第二个球的y坐标');
r2=input('第二个球的半径');
w=input('矩形宽');
h=input('矩形高');
&nbsp;
R=[0 w w 0;
&nbsp;&nbsp; 0 0 h h];
for I=1:4
A(I)=lineangle(a,b,R(1,I),R(2,I));
%A存放第一个球到矩形四个角的角度
end
Z=mirror(c,d,w,h);%z(2,5)存放了射击球的5个射击点
q=[0];
for I=1:5
&nbsp;&nbsp;&nbsp; [small,big]=fwei(Z(1,I),Z(2,I),a,b,r1+r2);
&nbsp;&nbsp;&nbsp; for J=1:4
&nb]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2006-12-12 10:15:00</pubDate>
		</item>
				<item>
		<title><![CDATA[时钟程序]]></title>
		<link>http://blog.pfan.cn/soliddream/6018.html</link>
		<description><![CDATA[#include&lt;iostream&gt; #include&lt;ctime&gt;#include &lt;windows.h&gt;&nbsp; //#include&lt;atlbase.h&gt; 加这个也可以using namespace std;
class Clock{public:&nbsp;&nbsp;&nbsp; Clock(int H=0,int M=0,int S=0):Hour(H),Minute(M),Second(S){};&nbsp; //构造函数，并初始化&nbsp;&nbsp;&nbsp; void SetClock(int H=0,int M=0,int S=0) {Hour=H;Minute=M;Second=S;} //设置时间&nbsp;&nbsp;&nbsp; void PrintClock();&nbsp; //输出时间&nbsp;&nbsp;&nbsp; operator++(); //重载++private:&nbsp;&nbsp;&nbsp; int Hour,Minute,Second;};
void Clock::PrintClock() //输出时间{&nbsp;&nbsp;&nbsp; cout&lt;&lt;Hour&lt;&lt;":"&lt;&lt;Minute&lt;&lt;":"&lt;&lt;Second&lt;&lt;endl;}
Clock::operator ++() //重载++{&nbsp;&nbsp;&nbsp; Second++;&nbsp;&nbsp;&nbsp; if(Second==60)&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Second=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Minute++;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(Minute==60)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-10-14 10:25:00</pubDate>
		</item>
				<item>
		<title><![CDATA[集合与子集]]></title>
		<link>http://blog.pfan.cn/soliddream/5960.html</link>
		<description><![CDATA[试编写一个递归函数，用来输出n 个元素的所有子集。例如，三个元素{a, b, c} 的所有子集是：{ }（空集），{a}, {b}, {c}, {a, b}, {a, c}, {b, c} 和{a, b, c}。 
#include&lt;iostream&gt;#include&lt;vector&gt;using namespace std;struct Gather{&nbsp;int a,b,c;&nbsp;Gather(int x=0,int y=0,int z=0):a(x),b(y),c(z){}};
ostream&amp; operator&lt;&lt;(ostream&amp;os,Gather&amp;ga){&nbsp;os&lt;&lt;'{';&nbsp;&nbsp;if(ga.a!=0)os&lt;&lt;ga.a;&nbsp;if(ga.b!=0)os&lt;&lt;ga.b;&nbsp;&nbsp;&nbsp; if(ga.c!=0)os&lt;&lt;ga.c;&nbsp;os&lt;&lt;'}';&nbsp;return os;}int main(){&nbsp;vector&lt;Gather&gt;subset;&nbsp;for(int i=0;i&lt;2;i++)&nbsp;&nbsp;for(int j=0;j&lt;2;j++)&nbsp;&nbsp;&nbsp;for(int k=0;k&lt;2;k++)&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int sub[3]={1,2,3};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(i==0)sub[0]=0;&nbsp;&nbsp;&nbsp;&nbsp;if(j==0)sub[1]=0;&nbsp;&nbsp;&nbsp;&nbsp;if(k==0)sub[2]=0;&nbsp;&nbsp;&nbsp;&nbsp;Gather temp(sub[0],sub[1],sub[2]);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sub]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-10-12 18:41:00</pubDate>
		</item>
				<item>
		<title><![CDATA[如何计算程序运行效率]]></title>
		<link>http://blog.pfan.cn/soliddream/5899.html</link>
		<description><![CDATA[#include&lt;ctime&gt;#include&lt;iostream&gt;using namespace std;//函数或类
int main(){&nbsp; time_t start,end;&nbsp;&nbsp; start = time(NULL);&nbsp;&nbsp; /* 代码段 */&nbsp;&nbsp; end = time(NULL);&nbsp;&nbsp; cout&lt;&lt;"消耗时间："&lt;&lt;(end-start)&lt;&lt;"秒"&lt;&lt;endl;&nbsp;&nbsp; return 0;}]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-10-11 13:50:00</pubDate>
		</item>
				<item>
		<title><![CDATA[shell排序]]></title>
		<link>http://blog.pfan.cn/soliddream/5664.html</link>
		<description><![CDATA[#include&lt;vector&gt;using namespace std;template&lt;class T&gt;void sort(vector&lt;T&gt;&amp;v){&nbsp;const size_t n=v.size();&nbsp;for(int gap=n/2;0&lt;gap;gap/=2)&nbsp;&nbsp;for(int i=gap;i&lt;n;i++)&nbsp;&nbsp;&nbsp;for(int j=i-gap;0&lt;=j;j-=gap)&nbsp;&nbsp;&nbsp;&nbsp;if(v[j+gap]&lt;v[j]){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;T temp=v[j];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v[j]=v[j+gap];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v[j+gap]=temp;&nbsp;&nbsp;&nbsp;&nbsp;}}//typedef sort&lt;int&gt;&nbsp; isort;#include&lt;iostream&gt;#include&lt;vector&gt;using namespace std;int main(){&nbsp;vector&lt;int&gt;rss;&nbsp;int data;&nbsp;cin&gt;&gt;data;&nbsp;while(data){&nbsp;&nbsp;rss.push_back(data);&nbsp;&nbsp;cin&gt;&gt;data;&nbsp;}&nbsp;sort&lt;int&gt;(rss);&nbsp;for(int i=0;i&lt;rss.size();i++)&nbsp;&nbsp;cout&lt;&lt;rss[i]&lt;&lt;'\t';&nbsp;cout&lt;&lt;endl;&nbsp;&nbsp;&nbsp; return 0;}
&nbsp;]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-10-04 20:32:00</pubDate>
		</item>
				<item>
		<title><![CDATA[桌面计算器]]></title>
		<link>http://blog.pfan.cn/soliddream/5433.html</link>
		<description><![CDATA[程序是一个计算器，有4个部分组成:1.语法分析器（Parser）,2.输入函数（input function）,3.符号表（symbol table）4.驱动（driver）.我是用的vc编译器，1，2，3用头文件，4用.cpp文件。第一部分Parser分析器，parser.h.作用是分析用户输入的语句的语法。用户可以在控制台输入以下内容：program:&nbsp;&nbsp;&nbsp;&nbsp;END&nbsp;&nbsp;&nbsp;&nbsp;expr_list ENDexpr_list:&nbsp;&nbsp;&nbsp;&nbsp;expression PRINT&nbsp;&nbsp;&nbsp;&nbsp;expression PRINT expr_listexpression:&nbsp;&nbsp;&nbsp;&nbsp;expression+term&nbsp;&nbsp;&nbsp;&nbsp;expression-term&nbsp;&nbsp;&nbsp;&nbsp;termterm:&nbsp;&nbsp;&nbsp;&nbsp;term*primary &nbsp;&nbsp;&nbsp;&nbsp;term/primary&nbsp;&nbsp;&nbsp;&nbsp;primaryprimary&nbsp;&nbsp;&nbsp;&nbsp;NUMBER&nbsp;&nbsp;&nbsp;&nbsp;NAME&nbsp;&nbsp;&nbsp;&nbsp;NAME&nbsp;&nbsp;= expression&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注释：在vc中这中间好像必须有空格，不然不行，过一会再讨论这个&nbsp;&nbsp;&nbsp;&nbsp;-primary&nbsp;&nbsp;&nbsp;&nbsp;(expression)这里说明了语法，也可以说是给用户说明了使用规则，比如：你在控制台内输入 12*3 ；，计算器就会显示36,其中不管是什么符号（这里有12，*，3，；四个）都要从primary开始进行分析（具体实现后面说），分析器分析12是NUMBER然后再取*号，向上到term，12附给了term,进行*发运算，primary又要从输入继续取值，于]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-28 09:02:00</pubDate>
		</item>
				<item>
		<title><![CDATA[有理数（运算符重载集锦）]]></title>
		<link>http://blog.pfan.cn/soliddream/4778.html</link>
		<description><![CDATA[#if!defined(RATIONAL_H)#define RATIONAL_H
#include&lt;iostream&gt;#include&lt;stdlib.h&gt;using namespace std;namespace std{&nbsp;class Rational{&nbsp;private:&nbsp;&nbsp;long num,den;&nbsp;&nbsp;void Standardize(void);&nbsp;&nbsp;long gcd(long m,long n)const;&nbsp;public:&nbsp;&nbsp;Rational(long p=0,long q=1);&nbsp;&nbsp;Rational(double x);&nbsp;&nbsp;&nbsp;&nbsp;friend istream&amp;operator&gt;&gt;(istream&amp;istr,Rational&amp;x);&nbsp;&nbsp;friend ostream&amp;operator&lt;&lt;(ostream&amp;ostr,const Rational&amp;x);
&nbsp;&nbsp;Rational operator+(Rational&amp;x)const;&nbsp;&nbsp;Rational operator-(Rational&amp;x)const;&nbsp;&nbsp;Rational operator*(Rational&amp;x)const;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rational operator/(Rational&amp;x)const;
&nbsp;&nbsp;Rational operator-(void)const;
&nbsp;&nbsp;int operator&lt;(Rational&amp;x)const;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int operator&lt;=(Rational&amp;x)const;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int operator=]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-15 11:29:00</pubDate>
		</item>
				<item>
		<title><![CDATA[挑战统计字符串频率最优算法的终极版]]></title>
		<link>http://blog.pfan.cn/soliddream/4754.html</link>
		<description><![CDATA[#include&lt;iostream&gt;
#include&lt;string&gt;
#include &lt;algorithm&gt;
#include&lt;stdlib.h&gt;
using namespace std;
void taxis(string&amp;s){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //选择排序
&nbsp;
for(int i=0;i&lt;s.size();i++)
&nbsp;
{
&nbsp;
&nbsp; int min=i;
&nbsp;
&nbsp; for(int j=i+1;j&lt;s.size();j++)
&nbsp;
&nbsp;&nbsp; if(s[j]&lt;s[min])
&nbsp;
&nbsp;&nbsp;&nbsp; min=j;
&nbsp;
&nbsp; int temp=s[i];
&nbsp;
&nbsp; s[i]=s[min];
&nbsp;
&nbsp; s[min]=temp;
&nbsp;
}
}
void main(){
&nbsp;&nbsp;&nbsp; string str;
&nbsp;&nbsp;&nbsp; cout&lt;&lt;"input the string:";
&nbsp;&nbsp;&nbsp; cin&gt;&gt;str;&nbsp;string s=str;
&nbsp;&nbsp;&nbsp; taxis(str);
&nbsp;&nbsp;&nbsp; int *p;
&nbsp;&nbsp;&nbsp; p=new int[str.size()];
&nbsp;&nbsp;&nbsp; for(int i=0,j=0;j&lt;str.size();++i)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p[i]=count(str.begin(),str.end(),str[j]);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; j+=p[i];
&nbsp]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-14 21:44:00</pubDate>
		</item>
				<item>
		<title><![CDATA[metaprogam用法一例]]></title>
		<link>http://blog.pfan.cn/soliddream/4743.html</link>
		<description><![CDATA[meta progamming（元编程） 是C++中非常有趣的一个功能
计算 1!+2!+3!+4!+ ...+n!, 如果用metaprogam完成则非常的有趣,代码如下:
template&lt;size_t n&gt;
struct factorial
{
&nbsp;&nbsp;&nbsp; enum{ val = n * factorial&lt;n-1&gt;::val };
};
template&lt;&gt;
struct factorial&lt;1&gt;
{
&nbsp;&nbsp;&nbsp; enum{ val = 1 };
};
&nbsp;
#include &lt;iostream&gt;
using namespace std;
int main( void )
{
&nbsp;&nbsp;&nbsp; cout &lt;&lt; factorial&lt;1&gt;::val
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + factorial&lt;2&gt;::val
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + factorial&lt;3&gt;::val
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + factorial&lt;4&gt;::val
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + factorial&lt;5&gt;::val &lt;&lt; endl;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;
}
&nbsp;
它和普通的写法有什么区别呢?区别在于普通的写法其结果是在运行时计算的,而metaprogam写法其结果却是在编译时计算的,不会占用任何运行时间.
上面的代码其实就等同于
int main( viod )
{
&nbsp;&nbsp;&nbsp; cout &lt;&lt; 153 &lt;]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-14 18:15:00</pubDate>
		</item>
				<item>
		<title><![CDATA[选择排序+折半查找]]></title>
		<link>http://blog.pfan.cn/soliddream/4742.html</link>
		<description><![CDATA[#include&lt;iostream&gt;using namespace std;const int size=16;void taxis(int score[],int num){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //选择排序&nbsp;for(int i=0;i&lt;num-1;i++)&nbsp;{&nbsp;&nbsp;int min=i;&nbsp;&nbsp;for(int j=i+1;j&lt;num;j++)&nbsp;&nbsp;&nbsp;if(score[j]&lt;score[min])&nbsp;&nbsp;&nbsp;&nbsp;min=j;&nbsp;&nbsp;int temp=score[i];&nbsp;&nbsp;score[i]=score[min];&nbsp;&nbsp;score[min]=temp;&nbsp;}}int Res(int score[],int num,int lookup){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //折半查找&nbsp;int lo=0,&nbsp;&nbsp;mid,&nbsp;&nbsp;hi=num-1,&nbsp;&nbsp;ans=-1;&nbsp;for(;hi-lo&gt;1;)&nbsp;{&nbsp;&nbsp;mid=(hi-lo)/2+lo;&nbsp;&nbsp;if(score[mid]==lookup)&nbsp;&nbsp;&nbsp;ans=mid;&nbsp;&nbsp;if(score[mid]&gt;lookup)&nbsp;&nbsp;&nbsp;hi=mid;&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;lo=mid;&nbsp;}&nbsp;if(ans==-1)&nbsp;{&nbsp;&nbsp;if(score[hi]==lookup)&nbsp;&nbsp;&nbsp;ans=hi;&nbsp;&nbsp;if(score[lo]==lookup)&nbsp;&nbsp;&nbsp;ans=lo;&nbsp;}&nbsp;&nbsp;return ans;}v]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-14 18:05:00</pubDate>
		</item>
				<item>
		<title><![CDATA[另类fib数列]]></title>
		<link>http://blog.pfan.cn/soliddream/4634.html</link>
		<description><![CDATA[#include&lt;iostream&gt;
#include&lt;iomanip&gt;
using namespace std;

int fib(int&amp;a,int&amp;b,int n){
&nbsp;&nbsp;&nbsp;&nbsp;int temp=a;
&nbsp;&nbsp;&nbsp;&nbsp;a=b;b=temp+b;
&nbsp;&nbsp;&nbsp;&nbsp;return b;
}
int fib(int n){
int a=0;
int b=1;
for(int i=0;i&lt;n-3;i++)
fib(a,b,i);
return fib(a,b,i);
}
void main()
{
&nbsp;&nbsp;&nbsp;&nbsp;int a=0,b=1;
&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;setw(6)&lt;&lt;a&lt;&lt;setw(6)&lt;&lt;b;
&nbsp;&nbsp;&nbsp;&nbsp;for(int i=2;i&lt;20;i++)
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(i%5==0)cout&lt;&lt;endl;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;setw(6)&lt;&lt;fib(a,b,i)&lt;&lt;setw(6);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;endl;
&nbsp;&nbsp;&nbsp;&nbsp;int n;
&nbsp;&nbsp;&nbsp;&nbsp;cin&gt;&gt;n;
&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;fib(n);
}
利用函数重载，第一个演示打印输出，第2个调用第一个函数演示查找]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-10 20:50:00</pubDate>
		</item>
				<item>
		<title><![CDATA[待改良电话卡]]></title>
		<link>http://blog.pfan.cn/soliddream/4633.html</link>
		<description><![CDATA[#include&lt;iostream&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
#include&lt;string&gt;
#include&lt;vector&gt;
using namespace std;
struct phone_book{
&nbsp;&nbsp;&nbsp;&nbsp;string name;
&nbsp;&nbsp;&nbsp;&nbsp;int number;
&nbsp;&nbsp;&nbsp;&nbsp;
};

vector&lt;phone_book&gt;phone_books;


&nbsp;&nbsp;&nbsp;&nbsp;
bool accept()
{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;&quot;Do you want to proceed(y or n)?\n&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char answer=0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cin&gt;&gt;answer;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(answer){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case'y':return true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case'n':return false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;&quot;I'll take that for a no.\n&quot;;
&nbsp;&n]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-10 20:39:00</pubDate>
		</item>
				<item>
		<title><![CDATA[另类最大公约数，最小公倍数]]></title>
		<link>http://blog.pfan.cn/soliddream/4632.html</link>
		<description><![CDATA[#include&lt;iostream&gt;
using namespace std;
void main(){
&nbsp;&nbsp;&nbsp;&nbsp;int a,b,c,d;
&nbsp;&nbsp;&nbsp;&nbsp;cin&gt;&gt;a&gt;&gt;b;
&nbsp;&nbsp;&nbsp;&nbsp;c=(a&gt;b)?a:b;
&nbsp;&nbsp;&nbsp;&nbsp;for(int i=c;i&gt;0;i--)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if((!(a%i))&amp;&amp;(!(b%i)))break;
&nbsp;&nbsp;&nbsp;&nbsp;d=(a*b)/i;
&nbsp;&nbsp;&nbsp;&nbsp;cout&lt;&lt;&quot;最大公约数&quot;&lt;&lt;i&lt;&lt;'\n'&lt;&lt;&quot;最小公倍数&quot;&lt;&lt;d&lt;&lt;endl;
}
目前关于此问题的通常解法就是碾转相除+递归。
&nbsp;&nbsp;&nbsp;&nbsp;]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-10 20:32:00</pubDate>
		</item>
				<item>
		<title><![CDATA[词典排序问题]]></title>
		<link>http://blog.pfan.cn/soliddream/4631.html</link>
		<description><![CDATA[#include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;vector&gt;
using namespace std;
void main(){
&nbsp;&nbsp;&nbsp;&nbsp;vector&lt;string&gt;p;
&nbsp;&nbsp;&nbsp;&nbsp;for(;;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//连续输入string对象，直到输入一个字母end
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;string str;
&nbsp;&nbsp;&nbsp;&nbsp;cin&gt;&gt;str;
&nbsp;&nbsp;&nbsp;&nbsp;if(str.size()==1)break;
&nbsp;&nbsp;&nbsp;&nbsp;p.push_back(str);
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;bool state;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//冒泡排序，将string对象按词典顺序排序
&nbsp;&nbsp;&nbsp;&nbsp;for(int i=0;i&lt;p.size();i++){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state=true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int j=p.size()-1;j&gt;i;j--){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(p[j].substr(0,1)&lt;p[j-1].substr(0,1)){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&]]></description>
		<author><![CDATA[solido1]]></author>
		<pubDate>2005-09-10 20:28:00</pubDate>
		</item>
		</channel>
</rss>