C++‎ > ‎

常數和跳脫字元

表示一個固定的值
#define PI = 3.141596

定義常數 Defined constants (#define)

#define PI 3.14159
#define NEWLINE '\n'

宣告常數 Declared constants (const)

const int pathwidth = 100;
const char tabulator = '\t';


跳脫字元 escape codes


 \n 換新行 New Line
 \r 游標移到最前面 Return
 \t 水平Tab
 \v 垂直Tab
 \b 退格 Backspace
 \f 跳頁 Form Feed
 \a 發出警告聲
 \' 
 '
 \" "
 \? ?
 \\ \
 \0 null
 \NNN 8進位字元
 \xNNN 16進位字元




Comments