随笔分类 - C++
摘要:short factor(int n,int *psquared,int *pcubed)
{
short value=0;
if(n>20)
value=1;
else
{
*psquared=n*n;
*pcubed=n*n*n;
阅读全文
摘要:void swap(int &rx,int &ry) //这里到底是什么意思??
{
int temp;
cout"swap.before swap. rx: "rx" ry: "ryendl;
temp=rx;
rx=ry;
ry=temp;
阅读全文
摘要: cout"&intone "&intoneendl;
cout"&rsomeref "&rsomerefendl;
阅读全文
摘要:#include using namespace std; int main() { int intone; int &rsomeref=intone; intone=5; cout<<"intone "<<intone<<endl <<"&rsomeref "<<rsomeref<<endl; rsomeref=7; cout<<"intone "<...
阅读全文
摘要:#include using namespace std; class Rectangle { public: Rectangle(); ~Rectangle(); void setlength(int length){itslength=length;} int getlength()const{return itslength;} void setwidth(int width){...
阅读全文
摘要:系统理解Win32 API和MFC(下)作者: 温昱 作者主页: lcspace.diy.163.com 系统理解Win32 API和MFC(上)二、MFC的概念模型 前面我们研究了WIN32 API的"领域模型",对它有较全面的认识。下面,对MFC概念模型的研究,我们把重点放在对app framework的研究上。app framework中的message响应/传递机制是最...
阅读全文
摘要:系统理解Win32 API和MFC(上) 作者: 温昱 作者主页: lcspace.diy.163.com Win32 API是微软的操作系统Windows提供给开发人员的编程接口,它决定了我们开发的Windows应用程序的能力。MFC是微软为开发人员提供的类库,在某种意义上是对Win32 API的封装。本文试图从全局角度对Win32 API和MFC进行理解──给出二者的概念模型。 本文使用U...
阅读全文
摘要: int getage() const {return *itsage;}
void setage(int age){*itsage=age;}
int getweight()const{return *itsage;}
void setweight(int weight){*itsweight=weight;}
阅读全文
摘要: simplecat *frisky=new simplecat;
coutgetage()setage(5);
阅读全文
摘要: cout"simplecat frisky..."endl;
simplecat frisky;
cout"simplecat *prages=new simplecat..."endl;
simplecat *prages=new simplecat;
cout"delete prages..."endl;
delete prages;
cout"exit. "endl;
阅读全文
摘要:unsigned short int *page=&myage;
阅读全文
摘要: ushort myage;
ushort *page=0;
myage=5;
cout"myage: "myageendl;
page=&myage; //将&myage的地址给page
cout"*page: "*pageendlendl;
阅读全文
摘要: unsigned short shortvar=5;
unsigned long longvar=65535;
long svar=-65535;
cout"shortvar:\t"shortvar;
cout"\taddress of shortvar:\t";
cout&shortvarendl;
阅读全文
摘要:#includeusing namespace std;enum choice{ drawrect=1, getarea, getperim, changedimensions, quit};class rectangle{public: rectangle(int width,int height); ~rectangle(); int getheight()const{return i...
阅读全文
摘要:我觉得人生求乐的方法,最好莫过于尊重劳动。一切乐境,都可由劳动得来,一切苦境,都可由劳动解脱。 —— 李大钊 我知道什麽是劳动:劳动是世界上一切欢乐和一切美好事情的源泉。 —— 高尔基 我只相信一条:灵感是在劳动时候产生的。……劳动,这是一切钝感的最好的医生。 —— 奥斯特洛夫斯基 知识是从刻苦劳动中得来的,任何成就都是刻苦劳动的结果。 —— 宋庆龄 应该记住,我们的事业,需要的是手,而不是嘴。 ...
阅读全文
摘要: for(;;)
{
if(countermax)
{
cout"hello!"endl;
counter++;
}
阅读全文
摘要: for(int i=0,j=0;i3;i++,j++)
cout"i "i"j "jendl;
阅读全文
摘要: for (counter=0;counter5;counter++)
cout"loop! ";
阅读全文
摘要:while(true)
{
counter++;
if(counter>10)
break;
}
阅读全文

浙公网安备 33010602011771号