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

正文內(nèi)容

c語言程序設(shè)計(jì)-實(shí)驗(yàn)程英粲c語言上機(jī)報(bào)告-資料下載頁

2025-03-23 00:24本頁面
  

【正文】 struct list *creat(int *a,int n){ struct list *loc_head=NULL。 if(n==0) return NULL。 else { loc_head=(struct list *) malloc(sizeof(struct list))。 loc_headdata=*a。 loc_headnext=creat(a+1,n1)。 return loc_head。 }}void insert(struct list *l,int i,int x){ int k=1。 struct list *p=l,*loc_head。 while(ki) { p=pnext。 k++。 } loc_head=(struct list *) malloc(sizeof(struct list))。 loc_headdata=x。 loc_headnext=pnext。 pnext=loc_head。}int main(){ struct list *head,*p。 int i,a[100],n,w,x。 printf(cin n\n)。 scanf(%d,amp。n)。 printf(input data\n)。 for(i=0。in。i++) scanf(%d,amp。a[i])。 head=creat(a,n)。 printf(input where and what you want\n)。 scanf(%d%d,amp。w,amp。x)。 if(w==0) printf(%d ,x)。 else insert(head,w,x)。 p=head。 while(p) { printf(%d ,pdata)。 p=pnext。 } getchar()。 getchar()。 return 0。 }運(yùn)行結(jié)果::刪除結(jié)點(diǎn)分析:跟插入一個(gè)效果源程序:includeincludestruct list{ int data。 struct list * next。}。struct list *creat(int *a,int n){ struct list *loc_head=NULL。 if(n==0) return NULL。 else { loc_head=(struct list *) malloc(sizeof(struct list))。 loc_headdata=*a。 loc_headnext=creat(a+1,n1)。 return loc_head。 }}void delete1(struct list *l,int i){ int k=1。 struct list *p=l,*loc_head。 while(ki1) { p=pnext。 k++。 } pnext=pnextnext。}int main(){ struct list *head,*p。 int i,a[100],n,w,x。 printf(cin n\n)。 scanf(%d,amp。n)。 for(i=0。in。i++) scanf(%d,amp。a[i])。 head=creat(a,n)。 printf(input where you want\n)。 scanf(%d,amp。w)。 if(w==1) head=headnext。 else delete1(head,w)。 p=head。 while(p) { printf(%d ,pdata)。 p=pnext。 } getchar()。 getchar()。 return 0。 }運(yùn)行結(jié)果::約瑟夫分析:終于可以用鏈表來寫這道題了,太合適不過了。源程序:includeincludestruct list{ int data。 struct list *next。} 。int n。struct list *creat(int i){ struct list *head_loc。 if(i==n+1) return NULL。 else { head_loc=(struct list *)malloc(sizeof(struct list))。 head_locdata=i。 head_locnext=creat(i+1)。 return head_loc。 }}/*void print(struct list *headp){ int i。 struct list *p。 p=headp。 for(i=0。in。i++) { printf(%d ,pdata)。 p=pnext。 } printf(\n)。}*/int main(){ struct list *head,*p,*q。 int k,m,i,t=0,s=0。 printf(請(qǐng)輸入人的個(gè)數(shù)N,開始的位置K,出列號(hào)M\n)。 scanf(%d%d%d,amp。n,amp。k,amp。m)。 head=creat(1)。 p=head。 for(i=0。in1。i++) p=pnext。 pnext=head。 p=head。 for(i=0。ik1。i++) p=pnext。 //printf(%d,pdata)。 q=p。 while(t!=n1) { s++。 if(s%m==0) { qnext=qnextnext。 t++。 s=0。 } q=p。 p=pnext。 //print(p)。 } printf(%d,pdata)。 return 0。}運(yùn)行結(jié)果::文件輸入輸出。分析:簡(jiǎn)單使用文件,比較有用。(注:為方便使用,均使用相對(duì)路徑,)源程序:includeinclude int main() { char c。 FILE *fin,*fout。 fout=fopen(,w+)。 fin=fopen(,r+)。 while((c=fgetc(fin))!=EOF) { fprintf(fout,%c,c)。 } fclose(fin)。 fclose(fout)。 return 0。 }運(yùn)行結(jié)果:四、實(shí)驗(yàn)體會(huì)。 這次的上機(jī)題目比較有意義,學(xué)到了很多鏈表的東西,同時(shí)也掌握了C語言文件的操作。C語言實(shí)踐與課程設(shè)計(jì)第二章一、實(shí)驗(yàn)?zāi)康模?)熟練掌握各種運(yùn)算各個(gè)地方的運(yùn)算功能,操作數(shù)的類型,運(yùn)算結(jié)果的類型及運(yùn)算過程中的類型轉(zhuǎn)換,重點(diǎn)是C語言特有的運(yùn)算符,問號(hào)運(yùn)算符,逗號(hào)運(yùn)算符。熟記運(yùn)算符的優(yōu)先級(jí)和結(jié)合性。(2)掌握getchar,putchar,scanf和printf的用法。(3)掌握(順序結(jié)構(gòu)程序)的編寫方法。二、程序設(shè)計(jì)(1)編寫一個(gè)程序,輸入字符c,如果c是大寫,則將c轉(zhuǎn)換成對(duì)應(yīng)的小寫,否則c不變,最后輸出。(2)編寫一個(gè)程序,輸入無符號(hào)短整數(shù)x,m,n(0=m=15,1=n=16m),取出x從第m位開始向左的n位(m從右至左編號(hào)為115),并使其向左端(第15位靠齊)。(3)IP地址通常是4個(gè)用句點(diǎn)分隔的小整數(shù)(即點(diǎn)分十進(jìn)制)。編程,讀入一個(gè)IP地址,對(duì)其譯碼,輸出。例如:676879571的二進(jìn)制是00101000010110000101110011010011。按照8位一組可表示為4088 92 211。三、實(shí)驗(yàn)步驟及結(jié)果:大寫換小寫分析:ASCII的運(yùn)用。源程序:includeint main(){ char c。 printf(輸入一個(gè)字符\n)。 scanf(%s,amp。c)。 if(c=39。A39。) { c=c39。A39。+39。a39。 } putchar(c)。 printf(\n)。 return 0。}運(yùn)行結(jié)果::取位分析:位運(yùn)算的使用。源程序:includevoid er(unsigned short int p){ unsigned short int t,q=0,a[16]={0}。 int i。 t=p。 for(i=15。i=0。i) { a[i]=t % 2。 t=t/2。 } for(i=0。i=15。i++) printf(%u,a[i])。 printf(\n)。} int main(){ unsigned short int x,m,n,t。 printf(請(qǐng)輸入x,m,n\n)。 //printf(%d%d%d)。 scanf(%u,amp。x)。 //printf(%u,x)。 t=x。 scanf(%u,amp。m)。 x=t。 t=m。 scanf(%u,amp。n)。 m=t。 er(x)。 x=x(mn+1)。 x=x(15n+1)。 er(x)。 return 0。}運(yùn)行結(jié)果::IP地址分析:對(duì)二進(jìn)制的處理,如果學(xué)了聯(lián)合,這題應(yīng)該很好寫(開始沒學(xué)?。┰闯绦颍篿ncludeincludevoid er(unsigned long int p){ unsigned long int t,q=0,a[32]={0}。 int i。 t=p。 for(i=0。i=31。i++) { a[i]=t % 2。 t=t/2。 } for(i=0。i=31。i++) { q+=a[i]*pow(2,i%8)。 if(i!=1amp。amp。(i+1)%8==0) { if(i!=31) { printf(%u.,q)。 q=0。 } else printf(%u,q)。 } } } int main(){ unsigned long int x,m,n。 printf(請(qǐng)輸入x\n)。 scanf(%u,amp。x)。 er(x)。 getchar()。 getchar()。 return 0。}運(yùn)行結(jié)果: 流程控制一、實(shí)驗(yàn)?zāi)康模?)掌握復(fù)合語句、if語句、switch語句的使用,熟練掌握for、while、dowhile三種基本的循環(huán)控制語句的使用,掌握重復(fù)循環(huán)技術(shù),了解轉(zhuǎn)移語句與標(biāo)號(hào)語句。(2)熟練運(yùn)用for、while、dowhile語句來編寫程序。(3)練習(xí)轉(zhuǎn)移語句和標(biāo)號(hào)語句的使用。(4)使用集成開發(fā)環(huán)境中的調(diào)試功能:?jiǎn)尾綀?zhí)行、設(shè)置斷點(diǎn)、觀察變量值。二、程序設(shè)計(jì)(1)計(jì)算稅收(2)一行字符串,多個(gè)空格用一個(gè)空格代替。(3)輸出楊輝三角(4)逆轉(zhuǎn)數(shù)字 選做:牛頓迭代法求方程近似根。三、實(shí)驗(yàn)步驟及結(jié)果 :計(jì)算稅收分析:swhich,if源程序1:includeint main(){ float x,sum。 printf(請(qǐng)輸入工資:)。 scanf(%f,amp。x)。 if(x1000) sum=0。 else if(x=1000amp。amp。x2000) sum=x*。 else if(x=2000amp。amp。x3000) sum=x*。 else if(x=3000amp。amp。x4000) sum=x*。 else if(x=4000amp。amp。x5000) sum=x*。 else if(x=5000) sum=x*。 printf(%.2f,sum)。 getchar()。 getchar()。 return 0。 }源程序2:includeint main(){ int t。 float x,sum。 printf(請(qǐng)輸入工資:)。 scanf(%f,amp。x)。 t=(int) x。 switch(t/1000)
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1