freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

[計算機]第2章數(shù)據(jù)類型與表達式-展示頁

2024-10-25 23:03本頁面
  

【正文】 define 符號常量 常量 例 符號常量舉例 () define PRICE 30 main() { int num,total。第二章 數(shù)據(jù)類型與表達式 C語言的數(shù)據(jù)類型 常量與變量 整型數(shù)據(jù) 實型數(shù)據(jù) 字符型數(shù)據(jù) 運算符和表達式 不同類型數(shù)據(jù)間的混合運算 167。 C語言的數(shù)據(jù)類型 ?數(shù)據(jù)類型總表 C 數(shù) 據(jù) 類 型 基本類型 構(gòu)造類型 指針類型 空類型 void 定義類型 typedef 字符類型 char 枚舉類型 enum 整 型 實型 單精度型 float 雙精度型 double 數(shù)組 結(jié)構(gòu)體 struct 共用體 union 短整型 short 長整型 long 整型 int 數(shù)據(jù)類型決定: 1. 數(shù)據(jù)占內(nèi)存字節(jié)數(shù) 2. 數(shù)據(jù)取值范圍 3. 其上可進行的操作 語言程序設(shè)計 第二章 數(shù)據(jù)類型與表達式 C ?基本數(shù)據(jù)類型 類型 符號 關(guān)鍵字 數(shù)的表示范圍 所占位數(shù) 整型 字符型 實型 有 無 (signed)int 16 32768~32767 (signed)short 16 32768~32767 (signed)long 32 2147483648~2147483647 16 unsigned int 0~65535 32 0~4294967295 unsigned long unsigned short 16 0~65535 有 float 32 ~ 有 double 64 ~ 有 char 8 128~127 無 unsigned char 8 0~255 語言程序設(shè)計 第二章 數(shù)據(jù)類型與表達式 C 167。 num=10。 printf(total=%d,total)。 printf(I say:\How are you?\\n)。 printf(Turbo \39。)。 } 運行結(jié)果: 屏幕顯示: = 打印機輸出: 165。 ch=“A”。 ch=?A?。 a b c 2字節(jié) 2字節(jié) 2字節(jié) 地址 地址 …... 內(nèi)存 1 3 ?? 隨機數(shù) ?變量 ?概念:其值可以改變的量 ?變量名 與 變量值 ?變量定義的一般格式: 數(shù)據(jù)類型 變量 1[,變量 2, … ,變量 n]。 float data。 float data=。 int x=1,y=1,z=1。 ?變量的使用: 先定義,后使用 例 1 int student。 //Undefined symbol ?stadent? in function main 例 2 float a,b,c。 //illegal use of floating point in function main ?變量定義位置: 一般 放在函數(shù)開頭 main() { int a,b=2。 a=1。 printf(“data=%f\n”,data)。 a=1。 data=(a+b)*。 } ?整型變量 ?占字節(jié)數(shù)隨機器不同而不同 ,一般占一個機器字 ?short≤int≤long ?可用 sizeof(類型標識符)測量 ?實型變量 ?float: 占 4字節(jié),提供 7位有效數(shù)字 ?double: 占 8字節(jié),提供 15~16位有效數(shù)字 ?字符型變量 ?字符變量存放字符 ASCII碼 ?char與 int數(shù)據(jù)間可進行算術(shù)運算 例 float a。 /* a=*/ double b。 /* b=*/ 例 a=?D?。 */ x=?A?+5。 */ s=?!?+?G? /* s=33+71。 float total。 total=num*PRICE。 printf(“total=%f,ch1=%c\n”,total,ch1)。 不同類型數(shù)據(jù)間的轉(zhuǎn)換 ?隱式轉(zhuǎn)換 ?什么情況下發(fā)生 ?運算轉(zhuǎn)換 不同類型數(shù)據(jù)混合運算時 ?賦值轉(zhuǎn)換 把一個值賦給與其類型不同的變量時 ?輸出轉(zhuǎn)換 輸出時轉(zhuǎn)換成指定的輸出格式 ?函數(shù)調(diào)用轉(zhuǎn)換 實參與形參類型不一致時轉(zhuǎn)換 ?運算轉(zhuǎn)換規(guī)則 :不同類型數(shù)據(jù)運算時先 自動 轉(zhuǎn)換成同一類型 語言程序設(shè)計 第二章 數(shù)據(jù)類型與表達式 C double float long unsigned int char,short 低 高 說明 : 必定的轉(zhuǎn)換 運算對象類型不同時轉(zhuǎn)換 例 char ch。 float f。 ch/i + f*d (f+i) int int double double double double double double int int double double double double double double 10+?a? +i*f d/l 例 int i。 double d。 ?顯式轉(zhuǎn)換(強制轉(zhuǎn)換) ?一般形式: ( 類型名 ) ( 表達式) 例 (int)(x+y) (int)x+y (double)(3/2) (int) ?說明:強制轉(zhuǎn)
點擊復(fù)制文檔內(nèi)容
教學課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1