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

正文內(nèi)容

高級(jí)語(yǔ)言程序設(shè)計(jì)課后習(xí)題答案寧愛軍版-資料下載頁(yè)

2025-06-25 13:40本頁(yè)面
  

【正文】 1next。 } else { pnext=p2。 p=p2。 p2=p2next。 } } if(p1!=NULL) pnext=p1。 else pnext=p2。 return(head)。}//鏈表排序函數(shù)如下(當(dāng)要連接的兩個(gè)鏈表為無序鏈表時(shí)) struct student *sort(struct student *head){ struct student *p。 int temp。 if(head==NULL) { printf(The list is NULL!\n)。 return(head)。 } for(p=headnext。pnext!=NULL。p=pnext) { if(pnumpnextnum) //當(dāng)前一個(gè)結(jié)點(diǎn)的指針指向的num大于它的next指針指向的num時(shí),交換num的值 { temp=pnum。 pnum=pnextnum。 pnextnum=temp。 } } return(head)。}void main(){ struct student *p1,*p2,*p3。 printf(請(qǐng)輸入鏈表1的信息,學(xué)號(hào)等于零時(shí)停止輸入:\n)。 p1=creat()。 printf(鏈表1的信息為:\n)。 print(p1)。 printf(請(qǐng)輸入鏈表2的信息,學(xué)號(hào)等于零時(shí)停止輸入:\n)。 p2=creat()。 printf(鏈表2的信息為:\n)。 print(p2)。 sort(p1)。 printf(排序后鏈表1的信息為:\n)。 print(p1)。 sort(p2)。 printf(排序后鏈表2的信息為:\n)。 print(p2)。 p3=connect(p1,p2)。 printf(合并后鏈表的信息為:\n)。 print(p3)。}/*struct student *sort(struct student *head){ struct student *p1,*p2,*nhead。 if(head==NULL) { printf(The list is NULL!\n)。 return(head)。 } p1=head。 p2=p1next。*/ 第十二章:位運(yùn)算/*輸入一個(gè)整數(shù),并輸出該整數(shù)轉(zhuǎn)換成二進(jìn)制后包含的二進(jìn)制位數(shù)*/includevoid main(){ int a[20]。 int m,n,x,i。 printf(請(qǐng)輸入一個(gè)十進(jìn)制數(shù)x=)。 scanf(%d,amp。x)。 n=0。 while(x=1) { m=x%2。 a[n++]=m。 x=x/2。 } printf(x包含的二進(jìn)制位數(shù)為:%d,n)。 printf(\n)。 for(i=n1。i=0。i) printf(%d,a[i])。 printf(\n)。}/*輸入一個(gè)整數(shù),并取出從右端開始的4到9位*/includevoid main(){ unsigned int m,n。 printf(請(qǐng)輸入一個(gè)十進(jìn)制整數(shù):)。 scanf(%d,amp。m)。 n=mamp。504。//504=111111000 printf(取這個(gè)數(shù)從右端開始的4到9位%d\n:,n)。}第十三章:文件/*按照每行10個(gè)數(shù),*/includeincludevoid main(){ FILE *fp。 int f[1000]。 int i,j,k,t。 int n=1。 if((fp=fopen(,w))==NULL) { printf(can not open the file\n)。 exit(0)。 } f[0]=2。 for(i=3。i1000。i++) //求1000以內(nèi)的素?cái)?shù) { k=i。 for(j=2。ji。j++) { t=i%j。 if(t==0)break。 } if(t!=0) { f[n]=k。 n++。 } } for(i=0。in。i++) //寫入文件 { if((i+1)%10==0) fprintf(fp,%4d\n,f[i])。 else fprintf(fp,%4d,f[i])。 } fclose(fp)。}/*一條學(xué)生記錄包括學(xué)號(hào)、姓名和成績(jī)等信息,按照以下要求編寫程序。(1)格式化輸入多個(gè)學(xué)生記錄。(2)。(3)利用fread從文件中讀出所有學(xué)生成績(jī)并求最大值和平均值。(4)將文件中的成績(jī)排序。*/includeincludeincludevoid main(){ struct student { char name[10]。 int number。 float score。 }。 FILE *fp。 struct student stu[3]。 int i,j。 float sum=0,av。 float smax。 if((fp=fopen(,w))==NULL) { printf(can not open the file\n)。 exit(0)。 } // printf(Input the info of student:\n)。 for(i=0。i3。i++) { scanf(%c%d%f,amp。stu[i].name,amp。stu[i].number,amp。stu[i].score)。 fwrite(amp。stu[i],sizeof(struct student),1,fp)。 //讀入一條記錄 } fclose(fp)。 // if((fp=fopen(,r))==NULL) { printf(can not open the file\n)。 exit(0)。 } printf(Output the info of student:\n)。 smax=stu[0].score。 for(i=0。i3。i++) { fread(amp。stu[i],sizeof(struct student),1,fp)。 printf(\t%c\t%d\t%f\n,stu[i].name,stu[i].number,amp。stu[i].score)。 sum=sum+stu[i].score。 if(stu[i].score=smax) smax=stu[i].score。 } av=sum/(i+1)。 printf(smax=%f,av=%f\n,smax,av)。 struct student temp。 //將文件中的成績(jī)排序 struct student s[3]。 for(i=1。i3。i++) for(j=0。j3i。j++) { if(stu[j].scorestu[j+1].score) { =stu[j].score。 strcpy(,stu[j].name)。 =stu[j].number。 stu[j].score=stu[j+1].score。 strcpy(stu[j].name,stu[j+1].name)。 stu[j].number=stu[j+1].number。 stu[j+1].score=。 strcpy(stu[j+1].name,)。 stu[j+1].number=。 } } for(i=0。i3。i++) { s[i].score=stu[i].score。 strcpy(s[i].name,stu[i].name)。 s[i].number=stu[i].number。 } fclose(fp)。 // if((fp=fopen(,w))==NULL) { printf(can not open the file\n)。 exit(0)。 } printf(Input the info of student:\n)。 for(i=0。i3。i++) { strcpy(stu[i].name,s[i].name)。 stu[i].number=s[i].number。 stu[i].score=s[i].score。 fwrite(amp。stu[i],sizeof(struct student),1,fp)。 //讀入一條記錄 } fclose(fp)。}/*從鍵盤輸入一個(gè)字符串,將其中所有的小寫字母全部轉(zhuǎn)換成大寫字母,然后再將文件中的內(nèi)容讀出顯示在屏幕上*/includeincludeincludevoid main(){ FILE *fp。 char str[100]。 int i,n=0。 if((fp=fopen(,w))==NULL) { printf(can not open the file\n)。 exit(0)。 } // printf(請(qǐng)輸入一個(gè)字符串:)。 gets(str)。 strupr(str)。 //小寫變大寫 fputs(str,fp)。 for(i=0。str[i]!=39。\039。i++) n++。 fclose(fp)。 // if((fp=fopen(,r))==NULL) { printf(can not open the file\n)。 exit(0)。 } fgets(str,n+1,fp)。 printf(%s,str)。 fclose(fp)。}
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1