//參數化巨集,#運算子可將引數變為字串
#define STR(data) #data
STR(hello)
2009年9月28日 星期一
2009年9月17日 星期四
C/C++筆記-逗號運算子
/* ,運算子是敘述結合,同等於{} */
if (total < 0) {
std::cout << "You owe nothing\n" ;
total = 0 ;
}
// 上面敘述同等於
if (total < 0)
std::cout << "You owe nothing\n", total = 0;
/* 常用在for迴圈內 */
for(two=0,three=0; two<10; two+=2,three+=3)
std::cout << two+three ;
##ShowAll##
訂閱:
文章
(
Atom
)