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

正文內(nèi)容

c語言程序?qū)嶒瀳蟾?-譚浩強-資料下載頁

2025-03-23 00:23本頁面
  

【正文】 。a)。printf(1.%f\n,a)。pa=amp。a。scanf(%f,pa)。 printf(1.%f\n,pa)。}調(diào)試后:includemain(){float a。float*pa。scanf(%f,amp。a)。printf(1.%f\n,a)。pa=amp。a。scanf(%f,pa)。 printf(2.%f\n,pa)。printf(%x,amp。a)。printf(%x,pa)。printf(%x,pa+1)。printf(amp。ld,sizeof(float))。} 運行結(jié)果: (3) 調(diào)試下面程序。includemain(){float a,b。float*pa=amp。a,*pb=amp。b。printf(%x\n,pa+pb)。printf(%x\n,papb)。printf(%x\n,pa+5)。printf(%x\n,pa5)。}錯誤信息:調(diào)試后程序:includemain(){float a,b。float*pa=amp。a,*pb=amp。b。printf(%x\n,papb)。printf(%x\n,papb)。printf(%x\n,pa+5)。printf(%x\n,pa5)。}運行結(jié)果:指針可以進行:指針變量加減一個整數(shù)、指針變量賦值、指針變量相減、指針變量比較。下面的程序能獲得上述結(jié)果么? 答:可以!includemain(){char *s=COMPUTER。 char c。 printf(which style you want to:\n)。 printf(capital(c)or uncapital(u):)。 c=getchar()。 if(c=39。c39。) puts(s)。 else { s=puter。 puts(s)。 }}(4) 設(shè)計一個C語言程序,用以測試下列各表達式的運算順序。設(shè)計程序如下:includemain(){ int y,*px,*py,*ppx,a,b,c。 px=amp。a。 py=amp。b。 ppx=amp。c。 y=*px++。 printf(%x\n,y)。 y=*++py。 printf(%x\n,y)。 y=(*py)++。 printf(%x\n,y)。 y=*ppx++。 printf(%x\n,y)。}運行結(jié)果如下: 實驗15(1)掌握結(jié)構(gòu)體類型的概念和定義方法以及結(jié)構(gòu)體變量的定義和引用。(2)掌握指向結(jié)構(gòu)體變量的指針變量的概念和應(yīng)用,特別是鏈表的概念和應(yīng)用。(3)掌握運算符“,”“”的應(yīng)用。(4)掌握共用體的概念和應(yīng)用。 做好下面的實驗準(zhǔn)備工作。 (1)程序功能 輸入具體的年月日,輸出該日期是這一年的第幾天。請將空白處填好。 完整程序如下:include static int day_tab[2][13]={0,31,28,31,30,31,30,31,31,30,31,30,31, 0,31,29,31,30,31,30,31,31,30,31,30,31}。 struct date { int day。 int month。 int year。 int yearday。 char month_name[5]。 }。 day_of_year(struct date * pd) { int day,i,leap。 leap=((*pd).year%400==0)||((*pd).year%4==0amp。amp。(*pd).year%100!=0)。 day=(*pd).day。 for(i=1。i(*pd).month。i++) day+=day_tab[leap][i]。 (*pd).yearday =day。 }struct date w。 main() { printf(Inout year_month_day please!)。 scanf(%4d %2d %2d,amp。,amp。,amp。)。 day_of_year(amp。w)。 printf(yearday=%d\n,)。 }(2)調(diào)試下列程序,分析數(shù)據(jù)之間的儲存關(guān)系。includestruct sf{ char *s。 struct sf * psf。}main(){ static struct sf x[]={{abcde,x+1},{fghij,x+2},{klmno,x}}。 struct sf *p[]。 int i。 for(i=0。i3。i++) p[i]=x[i].psf 。 printf((1)%s * %s%s\n,(*p)s ,(**p).s ,p[0]s)。 swap(*p,x)。 swap(p[0],p[0]psf )。 printf((3)%s * %s\n,p[0]s,(*++p[0]).s )。 printf((4)%s\n,++(++(*p)psf).s)。}swap(struct sf *p1,*p2){ char * temp。 temp=p1s。 p1s =p2s。 p2s=temp。}(3)下面的程序旨在建立一條單向鏈表儲存線性表(a1a2……an),然后將此線性表;逆置成(anan1…a2a1)。 完整程序如下:includestruct node{int num。struct node * next。}* head。int a[10]={1,2,3,4,5,6,7,8,9,10}。main(){ int i 。 struct node *p。 if(head!=NULL) { p=head。 pnum =a[0]。 } else { printf(\nmemory error?)。 exit(1)。 } for(i=2。i=10。i++) { pnext =(struct node *)malloc(sizeof(struct node))。 if(pnext !=NULL) { p=pnext。 pnum =a[i1]。 pnext =NULL。 } else break。 } reverse(head)。}reverse(struct node *p){ struct node *prt1,*prt2。 ptr1=pnext 。 while(ptr1next!=NULL) { ptr2=ptr1next。 ptr1next=p。 p=ptr1。 ptr1=ptr2。 } ptr1next=p。 headnext =NULL。 head=ptr1。} 實驗16 實驗?zāi)康呐c要求(1) 掌握文件和文件指針的概念以及文件的定義方法。(2) 了解文件打開和關(guān)閉的概念及方法。(3) 掌握有關(guān)文件的函數(shù)。實驗準(zhǔn)備做好下面實驗的準(zhǔn)備工作。實驗內(nèi)容和步驟(1)下面的程序要實現(xiàn)兩個文件之間的比較,具體功能如下。 1)使用命令行參數(shù)輸入兩個文件的文件名。 2)要求給出兩 個文件首次出現(xiàn)不同的行和字符時的位置。調(diào)試程序如下:includemain(int argc,char*argv[ ]){ FILE*f1,*f2,*fopen()。 int line=0,count=0。 char c1,c2。 if(argc2){ f1=fopen(argv[1],r)。 f2=fopen(argv[2],r)。 if(f1!=NULL amp。amp。 f2!=NULL) while((c1=getc(f1))!=EOF){ c2=getc(f2)。 if(c1==39。\t39。||c1==39。\n39。) count++。 else c2=getc(f1)。 if( !count ) line++。 } else{ printf(input filename isn39。t exist!\n)。 exit(1)。 if(c1==EOF) printf(two files is same.)。 else printf(two files is not =%d,cha_num=%d\n,line,count)。 fclose(f1)。 fclose(f2)。 } } else printf(Usage:e91 filename 1
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1