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

正文內(nèi)容

數(shù)據(jù)的組織結(jié)構(gòu)--字符串、二維數(shù)組(參考版)

2025-05-13 03:04本頁(yè)面
  

【正文】 if( a[i] b[i] ) printf(“a中串小于 b中串 \n)。 if( a[i] b[i] ) printf(“a中串大于 b中串 \n)。\039。amp。 gets(b)。 char a[30],b[30]。 } 不能寫成if( ab ) 53 【 例 4_2】 編寫字符串比較的程序 。 if( strcmp(a,b) == 0 ) printf(兩串相等 \n)。 gets(b)。 strcmp b o o k \0 b o y \0 ∧ = = “boy”“book” 比較串的規(guī)則: 按 ASCII碼值比較 52 include include main( ) { char a[30],b[30]。 puts(a)。 } a[i]=39。 i++。\039。 ) i++。 while( a[i]!=39。 gets(a)。 50 include main( ) { int i=0,j=0。 } a[i]=39。 i++。\039。 ? … … … … …… …… 49 【 例 3_2】 連接字符串的自編程序。\039。 48 【 例 3_2】 連接字符串的自編程序。 puts(a)。 gets(b)。 } 程序?qū)崿F(xiàn) 47 include include main( ) { char a[80],b[30]。\039。 i++。\039。 gets(a)。 46 include main( ) { int i=0。 } b[i]=39。 ) { b[i]=a[i]。 I a m O K \0 … a b I a m O K \0 … … while( a[i]!=39。 strcpy(b,temp)。 strcpy(temp,a)。 44 char a[5]=”ABCD”,b[5]=”abcd”。 strcpy(a,“abcde”)。 puts(b)。 gets(a)。 } printf(%s: %d\n,a,count)。 ) { count++。 while( a[i] != 39。 int i=0,count=0。 } 運(yùn)行結(jié)果: I am OK? I am OK: 7 問: strlen(“Good”)的值 ? 【 例 1_1】 求字符串長(zhǎng)度函數(shù)的使用。 count=strlen(a)。 int count。 } printf(\nThe matrix is symmetrical.)。t symmetrical.)。 ji。 iNUM。 printf(\n)。 jNUM。 iNUM。m[i][j])。 jNUM。 iNUM。 /* 輸入 矩陣 */ printf(\Enter %d rows %d cols datas for the maxtrix:\n,NUM,NUM)。 … /* 輸出 2行 3列的矩陣 */ } 1 2 3 4 5 6 1 3 5 2 4 6 35 例:判定給定方陣是否為對(duì)稱矩陣 ? 每個(gè)元素都應(yīng)滿足 array[i][j] == array[j][i] ? 判斷對(duì)稱性,只需用 下三角 的每個(gè)元素與對(duì)應(yīng)的 上三角 元素進(jìn)行比較 1 2 3 4 5 2 1 2 3 4 3 2 1 2 3 4 3 2 1 2 5 4 3 2 1 教材 P109 例 413 36 include define NUM 5 /* 矩陣行列數(shù) */ main( ) { int m[NUM][NUM]。 j2。 i3。 int i, j。 { } 34 例 轉(zhuǎn)置矩陣的計(jì)算 include main( ) { int x[ 3 ][ 2 ] = { {1,2}, {3,4}, {5,6} }。 j++) printf(“%d”, a[i][j])。 i++) for(j=0。 ? 輸出 for(i=0。 j++) scanf(“%d”, amp。 i++) for(j=0。 ? 輸入 for(i=0。j3。i2。 33 ? 二維數(shù)組的引用 ? 賦值 int a[2][3]。 ? 對(duì) 部分 元素賦初值 int a[3][4]={{1},{5},{9}}。 ? 按數(shù)組 排列順序 對(duì)各元素賦初值 int a[3][4]={1,2,3,4,5,6,7,8,9,10,11,12}。 用下標(biāo)訪問 – 數(shù)組元素的引用形式 :數(shù)組名 [下標(biāo) ][下標(biāo) ] 31 ? 二維數(shù)組的存儲(chǔ) a[1][2] a[1][1] a[1][0] a[0][2] a[0][1] a[0][0] a[2][0] a[2][1] a[2][2] a[0][3] a[1][3] a[2][3] 例如: int a[3][4]。 ? 定義格式: 數(shù)據(jù)類型 數(shù)組名 [行長(zhǎng)度 ][列長(zhǎng)度 ]; – double arr[ 10 ][ 20 ]。 ? str1是主串 , str2是子串 ? 若在 str1中存在子串 str2, 則返回子串 str2在主串中第一次出現(xiàn) ( 第一個(gè)字符 ) 的位置 ( 指針 ) ;否則返回空 ? 在字串中找字符出現(xiàn)位置的函數(shù) strchr(st
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1