顯示具有 運算子 標籤的文章。 顯示所有文章
顯示具有 運算子 標籤的文章。 顯示所有文章

2009年9月28日 星期一

C/C++筆記-#運算子

//參數化巨集,#運算子可將引數變為字串
#define STR(data) #data
STR(hello)

C/C++筆記->>右移運算子

無號數,直接補0,
有號數時,正號補0,負號補1

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##
/