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

正文內(nèi)容

第9章結(jié)構(gòu)體和共用體-文庫吧

2025-07-17 15:11 本頁面


【正文】 int year。 }birthday。 }stu1,stu2。 num name birthday month day year =12。 例 struct student { int num。 char name[20]。 char sex。 int age。 float score。 char addr[30]。 }stu1,stu2。 if(stu1==stu2) …….. ( ?) The C Programming Language Chapter 9 Structures and Unions ? 結(jié)構(gòu)體變量的初始化 – 形式一: struct 結(jié)構(gòu)體名 { 類型標(biāo)識符 成員名; 類型標(biāo)識符 成員名; ……………. }; struct 結(jié)構(gòu)體名 結(jié)構(gòu)體變量 ={初始數(shù)據(jù) }; 例 struct student { int num。 char name[20]。 char sex。 int age。 char addr[30]。 }。 struct student stu1={112, Wang Lin, 39。M39。,19, 200 Beijing Road}。 The C Programming Language Chapter 9 Structures and Unions – 形式二: struct 結(jié)構(gòu)體名 { 類型標(biāo)識符 成員名; 類型標(biāo)識符 成員名; ……………. }結(jié)構(gòu)體變量 ={初始數(shù)據(jù) }; 例 struct student { int num。 char name[20]。 char sex。 int age。 char addr[30]。 }stu1={112, Wang Lin, 39。M39。,19, 200 Beijing Road}。 The C Programming Language Chapter 9 Structures and Unions – 形式三: struct { 類型標(biāo)識符 成員名; 類型標(biāo)識符 成員名; ……………. }結(jié)構(gòu)體變量 ={初始數(shù)據(jù) }; 例 struct { int num。 char name[20]。 char sex。 int age。 char addr[30]。 }stu1={112, Wang Lin, 39。M39。,19, 200 Beijing Road}。 The C Programming Language Chapter 9 Structures and Unions ? 結(jié)構(gòu)體數(shù)組 – 結(jié)構(gòu)體數(shù)組的定義 三種形式: 形式一 : struct student { int num。 char name[20]。 char sex。 int age。 }。 struct student stu[2]。 形式二 : struct student { int num。 char name[20]。 char sex。 int age。 }stu[2]。 形式三 : struct { int num。 char name[20]。 char sex。 int age。 }stu[2]。 num name sex age num name sex age stu[0] stu[1] 25B The C Programming Language Chapter 9 Structures and Unions – 結(jié)構(gòu)體數(shù)組初始化 例 struct { int num。 char name[20]。 char sex。 int age。 }stu[ ]={{……},{……},{……}}。 順序初始化 : struct student { int num。 char name[20]。 char sex。 int age。 }。 struct student stu[ ]={100, Wang Lin, 39。M39。,20, 101, Li Gang, 39。M39。,19, 110, Liu Yan, 39。F39。,19}。 例 struct student { int num。 name[20]。 char sex。 int age。 }stu[ ]={{……},{……},{……}}。 分行初始化 : struct student { int num。 char name[20]。 char sex。 int age。 }。 struct student stu[ ]={{100, Wang Lin, 39。M39。,20}, {101, Li Gang, 39。M39。,19}, {110, Liu Yan, 39。F39。,19}}。 全部初始化時維數(shù)可省 – 結(jié)構(gòu)體數(shù)組引用 引用方式: 結(jié)構(gòu)體數(shù)組名 [下標(biāo) ].成員名 struct student { int num。 char name[20]。 char sex。 int age。 }str[3]。 stu[1].age++。 strcpy(stu[0].name, ZhaoDan”)。 The C Programming Language Chapter 9 Structures and Unions 例 1:計算學(xué)生的平均成績和不及格人數(shù) ?struct student ? { ? int num。 ? char name[20]。 ? float score。 ? }student1[5] = { ? {1001, Li ping,55}, ? {1002, Zhang ping, 80}, ? {1003, Wang fang, 75}, ? {1004, Cheng lin, 82}, ? {1005, Wu yong, 94}}。 ? main() ? { ? int i , c = 0。 ? float average, s=0。 ? for(i=0 。 i5 。 i++) ? ?{ ? s += student1[i].score。 ? if(student1[i]60) c+=1。 ?} ?average = s/5 。 ?printf( average=%f\n ?count=%d\n ,av
點擊復(fù)制文檔內(nèi)容
化學(xué)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1