gzpk

随笔分类 -  Beauty of Programming

List
摘要:C++ 锁 阅读全文

posted @ 2015-09-14 16:59 gzpk 阅读(299) 评论(0) 推荐(0)

effetive C++ 02 尽量以const,enum,inline替换#define
摘要:#define ASPECT_RATIO=1.1const double AspectRatio=1.11. 使用宏会导致预处理器把程序代码中的ASPECT_RATIO无条件替换为1.1,编译器从未见过ASPECT_RATIO,调试编译会很难跟踪,const常量可以解决这个问题。2. 宏定义的作用域... 阅读全文

posted @ 2015-08-05 16:50 gzpk 阅读(357) 评论(0) 推荐(0)

赋值语句1
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include<iostream>usingnamespacestd;intmain(){intx=2,y,z;x*=(y=z=5);cout<<x<<endl;... 阅读全文

posted @ 2010-09-19 09:40 gzpk 阅读(197) 评论(0) 推荐(0)

1.2将帅问题
摘要:题目:棋盘中只有将帅,列出他们的所有合法位置,要求只用一个变量 。代码1:[代码]intmain(){chari=81;while(i--){if(i/9%3==i%9%3)continue;printf("i=%d,A=%d,B=%d\n",i,i/9+1,i%9+1);}return0;}代码2:代码Code highlighting produced by Actipro CodeHighl... 阅读全文

posted @ 2010-06-24 16:35 gzpk 阅读(150) 评论(0) 推荐(0)

导航