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

正文內(nèi)容

c語(yǔ)言課后習(xí)題答案(編輯修改稿)

2025-07-25 08:13 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 gets(str)? /*輸入字符串*/ Inverse(str)? /*將存于 str 數(shù)組中的字符串逆序存放*/ printf(The inversed string is:\n)? puts(str)? /*輸出字符串*/ } /*函數(shù)功能: 實(shí)現(xiàn)字符串逆序存放 函數(shù)參數(shù): 字符指針變量,所指向的存儲(chǔ)單元存放源字符串,逆序后的字符串也存放于此 返回值: 無(wú)*/ void Inverse(char *pStr) { int len? char temp? char *pStart? /*指針變量 pStart 指向字符串的第一個(gè)字符*/ char *pEnd? /*指針變量 pEnd指向字符串的最后一個(gè)字符*/ len = strlen(pStr)? /*求出字符串長(zhǎng)度*/ for (pStart=pStr,pEnd=pStr+len?1? pStartpEnd? pStart++,pEnd??) { temp = *pStart? *pStart = *pEnd? *pEnd = temp? } } 10 個(gè)整數(shù),用函數(shù)編程實(shí)現(xiàn)計(jì)算最大值和最小值,并返回它們所在數(shù)組 中的位置。 include int FindMax(int num[], int n, int *pMaxPos)? int FindMin(int num[], int n, int *pMinPos)? main() { int num[10], maxValue, maxPos, minValue, minPos, i? printf(Input 10 numbers:\n )? for (i=0? i10? i++) { scanf(%d, amp。num[i])? /* 輸入 10 個(gè)數(shù)*/ } maxValue = FindMax(num, 10, amp。maxPos)? /* 找最大值及其所在下標(biāo)位置 */ minValue = FindMin(num, 10, amp。minPos)? /* 找最小值及其所在下標(biāo)位置 */ printf(Max=%d, Position=%d, Min=%d, Position=%d\n, maxValue, maxPos, minValue, minPos)? } /*函數(shù)功能:求 n個(gè)數(shù)中的最大值及其所在下標(biāo)位置 函數(shù)入口參數(shù):整型數(shù)組 num,存儲(chǔ) n個(gè)整數(shù),整型變量 n,表示數(shù)組元素個(gè)數(shù) 函數(shù)出口參數(shù):整型指針變量 pMaxPos,指向的地址單元存儲(chǔ)最大值在數(shù)組中的下標(biāo)位置 函數(shù)返回值: 最大值*/ int FindMax(int num[], int n, int *pMaxPos) { int i, max? max = num[0]? /*假設(shè) num[0]為最大*/ *pMaxPos = 0? /*假設(shè)最大值在數(shù)組中的下標(biāo)位置為 0 */ for (i = 1? i n? i++) { if (num[i] max) { max = num[i]? *pMaxPos = i? } } return max ? } /*函數(shù)功能: 求 n個(gè)數(shù)中的最小值及其所在下標(biāo)位置 函數(shù)入口參數(shù): 整型數(shù)組 num,存儲(chǔ) n個(gè)整數(shù),整型變量 n,表示數(shù)組元素個(gè)數(shù) 函數(shù)出口參數(shù): 整型指針變量 pMinPos,指向的地址單元存儲(chǔ)最小值在數(shù)組中的下標(biāo)位置 函數(shù)返回值: 最小值*/ int FindMin(int num[], int n, int *pMinPos) { int i, min? min = num[0]? /*假設(shè) num[0]為最小*/ *pMinPos = 0? /*假設(shè)最小值在數(shù)組中的下標(biāo)位置為 0 */ for (i = 1?i 10?i++) { if (num[i] min) { min = num[i]? *pMinPos = i? } } return min ? } 3. 將 5 個(gè)字符串從小到大排序后輸出。 include void main(void) { int i? char *pcolor[5]={ red, blue, yellow, green, purple }? void fsort(char *color[ ], int n)? fsort( pcolor, 5 )? for(i = 0? i 5? i++) printf(%s , pcolor[i])? } void fsort(char *color[ ], int n) { int k, j? char *temp? for(k = 1? k n? k++) for(j = 0? j n?k? j++) if(strcmp(color[j],color[j+1])0) { temp = color[j]? color[j] = color[j+1]? color[j+1] temp? } } 4. 編寫一個(gè)能對(duì)任意mn階矩陣進(jìn)行轉(zhuǎn)置運(yùn)算的函數(shù) Transpose()。 include define ROW 3 define COL 4 void Transpose(int (*a)[COL], int (*at)[ROW], int row, int col)? void InputMatrix(int (*s)[COL], int row, int col)? void PrintMatrix(int (*s)[ROW], int row, int col)? main() { int s[ROW][COL]? /*s 代表原矩陣*/ int st[COL][ROW]? /*st 代表轉(zhuǎn)置后的矩陣*/ printf(Please enter matrix:\n)? InputMatrix(s,
點(diǎn)擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1