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

正文內容

(最新)c語言程序設計案例教程實驗項目-設計性題目參考答案(文件)

2024-12-07 07:34 上一頁面

下一頁面
 

【正文】 組 a; ? 要求 用指向函數(shù)的指針 調用 invert函數(shù) ; 輸出數(shù)組 a。 p=invert。a[i])。 printf(\n)。i++) printf(%4d,a[i])。i(N1)/2。 } printf(\n)。 } 程 序 代碼 2: include define N 10 void main ( ) { int invert(int x[])。 for (i=0。 for (i=0。 (*p)(a) 。i=(N1)。 for (i=0。 猴子選王問題:一群編號是 1, 2, 3 ...m 的猴子( m個)按照 1m 的順序圍坐一圈,從第 1開始數(shù)數(shù),每數(shù)到 n( nm)時,該猴子就要離開此圈,這樣依次下來,直到圈中只剩下最后一只猴子,則該猴子為大王。 程序代碼: include include typedef struct clink { int no。 clink *p,*q。 /*使 q 指向當前鏈表的尾結點 */ for(i=2。 qnext=p。 clink *q。 /*指針 p 指向報數(shù)為 n 的前驅結點 */ /*以下為所填語句 */ q=(*p)next。 *p=(*p)next。n(mnamp。m,amp。 p=head。 printf(Monkey king is %d\n,headno)。 要求 ① 編寫 函數(shù) , 輸入 5個學生的數(shù)據(jù)。 程序代碼: include include struct student { int num。 struct student *next。 head=(struct student *)malloc(sizeof(struct student))。i=5。pnum)。 scanf(%d,amp。 /*q指向新的表尾結點 */ } qnext=NULL。 while(pnext){ q=pnext。 } } void print(struct student *head) /* 輸出帶頭結點的鏈表 head中的各結點的數(shù)據(jù)元素 */ { struct student *p。 } } void main() { struct student *head,*p,*q。 printf(Input age:)。 print(head)。 } void main() { int x,y,x1,y1。 min=f(1,1)。x++) for(y=1。 y1=y。 } ( 2) 新建一個含有字符 ’$’ 的 文 本文件,統(tǒng)計文本文件 中字符 ’$’ 出現(xiàn)的次數(shù),并將統(tǒng)計結果寫入文件 中。 FILE *fp1,*fp2。$39。 fclose(fp2)。 fprintf(fp2,%d,count)。 fp2=fopen(,w)。 程序代碼: include void main() { int count=0。 printf(%d,%d,x1,y1)。y++) if(minf(x,y)) { min=f(x,y)。 for(x=1。 FILE *fp。 實驗 提示 ① 利用雙重循環(huán)結構求 f(x,y) 取最小值的 x y1; ② 對 文件 的操作過程參見設計性實驗內容。age)。 printf(list is:\n)。 /*p指向鏈表中第一個結點 */ while(p) {printf(%10d%10s%c%10d\n,pnum,pname,psex,page)。 free(q)。 } void dellink(struct student *head,int age) { struct student *p,*q。 qnext=p。 gets(pname)。 printf(input num ,name,sex and age:\n)。 q=head。 struct student * createlink( ) /* 用尾插法建立一個帶頭結點的鏈表 head */ { int i。 char sex。 實驗 提示 ① 采用結構體 及其 指針編程 ; ② 建立一個單鏈表。 鏈表 中的 每個結點包括 : 學號 , 姓名 ,性別 , 年齡。head,amp。 creat(amp。n1):)。 clink *head=NULL,*p。 free(q)。in。 } qnext=*head。i++) { /*以下為所填語句 */ p=(clink *)malloc(sizeof(clink))。 /*生成鏈表中的第一個結點 */ (*head)no=1。 }clink。 實驗提示 輸入數(shù)據(jù)是 m 和 n 兩個整數(shù),其中 nm 且 n1,輸出是最后為王的猴子編號。i++) printf(%4d,a[i])。 x[i] = x[Ni1] x[Ni1]= temp。 { int i,temp。i++) printf(%4d,a[i])。i++) scanf(%d,amp。 int (*p)() 。iN。 x[i]=x[Ni1]。 } invert(int x[]) {int i,n,temp。 for(i=0。iN。iN。 int i,a[N]。 實驗提示 ① 編寫函數(shù) void invert(int *, int)將 n個數(shù)按反序存放 。 P1++。 } } viod substrcpy(char *p1, char *p2 ,int m) { int n=0。m)。 printf(“input string: “)。 實驗 提示 ① 編寫函數(shù) void substrcpy(char *, int ,char *)將字符串 1中第 m個字符開始的所有字符復制成字符串 2。 plist+n。 } } 實驗項目 八 指針 及其應用 題目 ( 1) 編寫 函數(shù) int search(int list[], int n, int x),在數(shù)組 list中查找元素 x,若找到則返回相應下標,否則返回 1。j++) /*輸出排序后的成績 */ { for(k=0。 a[i+1][k]=s。i++) if (a[i][6]a[i+1][6]) /*按平均成績排序 */ for(k=0。 } for(j=1。j++) { for(k=0。 /*計算平均成績存入第 6 列 */ a[j][5]=t。k++) { scanf(%d,amp。j=6。 for(i=1。 } printf(\n can`t find %d ! ,x)。 if(x==a[mid]) { printf(\n%d=a[%3d ]\n,x,mid1)。 /* zheban find x */ } void badd (int x,int a[] ,int n) { int mid,top,bot。 printf(\n)。 printf(\n The sorted numbers: \n)。i=10。 scanf(%d,amp。 printf(Enter data:\n)。 a[i]=a[min]。
點擊復制文檔內容
法律信息相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1