摘要:#define ASPECT_RATIO=1.1const double AspectRatio=1.11. 使用宏会导致预处理器把程序代码中的ASPECT_RATIO无条件替换为1.1,编译器从未见过ASPECT_RATIO,调试编译会很难跟踪,const常量可以解决这个问题。2. 宏定义的作用域...
阅读全文
摘要:代码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;...
阅读全文
摘要:题目:棋盘中只有将帅,列出他们的所有合法位置,要求只用一个变量 。代码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...
阅读全文