Ch21整數常數表示法 11 10 ≠011 8 Ch2 1 i10進 08進 ≠0x1116 1<stdio. h> %X16進 2 minot 3 printf("The decimal of 11 is %i n, 11 y 4 printf("The decimal of 011 is %i In,011 5 printf(" The decimal of0x11is%i.in"、0×11 6} decimal The decimal of 11 is 11 十進制 The decimal of 011 is 9 The decimal of 0x11 is 17 21
21 Ch2_1 整數常數表示法 The decimal of 11 is 11. The decimal of 011 is 9. The decimal of 0x11 is 17. Ch2_1 1 #include<stdio.h> 2 main(){ 3 printf("The decimal of 11 is %i.\n", 11 ); 4 printf("The decimal of 011 is %i.\n", 011 ); 5 printf("The decimal of 0x11 is %i.\n", 0x11 ); 6 } 1110 0118 0x1116 decimal =十進制 %i 10進 %o 8進 %x 16進
2-1-2浮點foat常數 帶有小數點的數,包括正丶負數 浮點常數的表示法如下 小數點表示法( decimal notation) 科學符號表示法( scientific notation),又稱為 指數表示法 exponential notation)° axion 22
22 • 帶有小數點的數,包括正、負數。 • 浮點常數的表示法如下: – 小數點表示法(decimal notation)。 – 科學符號表示法(scientific notation),又稱為 指數 表示法(exponential notation)。 2-1-2 浮點float常數 m×10n
Ch22浮點常數表示法 Ch2 2 1 #include<stdio. h> 2 main(t 3 printf( "The decimal notation is %f n", 6.9102119) 4 printf( The scientific notation is %e In, 6.9102119) 5} 6.910212×100 The decimal notation is 6.910212 The scientific notation is 6.910212e+00 23
23 Ch2_2 浮點常數表示法 The decimal notation is 6.910212. The scientific notation is 6.910212e+00. Ch2_2 1 #include<stdio.h> 2 main(){ 3 printf("The decimal notation is %f.\n", 6.9102119); 4 printf("The scientific notation is %e.\n", 6.9102119); 5 } 6.910212×100
2-1-3字元常數 用一對 單引號 英文字母A',"a 將字元 框起來 數字 控制字元(特殊) Nt',"\ a 参閱 其他符號 ASCII 字符表 24
24 • 英文字母 'A','a' • 數字 '0','9' • 控制字元(特殊) '\t','\n','\a' • 其他符號 '+','-','!' 2-1-3 字元常數 用一對 單引號 將字元 框起來 參閱 ASCII 字符表
Ch23字元與 ASCII Code Ch23字元與 ASCII Code值的轉换 1#include<stdio h> 2 minot 3 printf( The ASCll Code of oc is oi.n,'A,A); 4 printf( The Ascll Code of oc is oi.n,97,97) 5 printf(" %1! =%in,0, 0) 6 The ASCII Code of A is 65 The ASCII Code of 7 48!=0 25
25 Ch2_3 字元與ASCII Code The ASCII Code of A is 65. The ASCII Code of a is 97. 48 != 0 Ch2_3 字元與ASCII Code值的轉換 1 #include<stdio.h> 2 main(){ 3 printf("The ASCII Code of %c is %i.\n", 'A','A'); 4 printf("The ASCII Code of %c is %i.\n", 97,97); 5 printf("%i != %i\n", '0', 0); 6 }