跳轉到內容

理解 C++/快速參考

來自華夏公益教科書,開放的書籍,為開放的世界
預處理器
#include <stdio.h> 包含 stdio.h 的內容
#error text 顯示 text 作為編譯時錯誤
#warning text 顯示 text 作為編譯時警告
#pragma 編譯器特定選項
#define M 定義 M
#undef M 取消定義 M
#if (condition) 條件編譯
#ifdef M 如果 M 已定義則編譯
#ifndef M 如果 M 未定義則編譯
#elif (condition) 條件編譯
#else 條件編譯
#endif 結束條件部分
defined() 宏是否已定義。
!defined() 宏是否未定義
M ## D 將 M 和 D 合併為 MD
#M 將 M 視為字串 "M"
語法
if (bool expr) block [else block]
for ([expr];[condition];[expr]) block
while (condition) block
do { } while (condition)
type identifier([type identifier, ...]);
type identifier([type identifier, ...]) { }
class identifier [:[private|public] type, ...];
class identifier [:[private|public] type, ...] { [private:] };
struct identifier [:[public|private] type, ...];
struct identifier [:[public|private] type, ...] { [public:] };
union identifier;
union identifier { type identifier; ... };
enum identifier;
enum identifier { identifier [=int_value], ... }';
typedef type identifier;
邏輯與(&&)和邏輯或(||)查詢表

邏輯或


邏輯與

邏輯異或

異或
華夏公益教科書