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

正文內(nèi)容

c語言程序?qū)嶒瀳蟾?-譚浩強(已改無錯字)

2023-04-23 00:23:58 本頁面
  

【正文】 本質(zhì)。(1)下面是一個用來求2^2+4^2+6^2的程序代碼段,請在“?!碧幪顚戇m當(dāng)?shù)拇a,完善這個程序。要求在主函數(shù)中f1()的實參必須使用汗a的表達式。完善程序如下:includemain(){ int a=0。 printf(%1d,f1(a+2,a+4,a+6))。}long f1(int a,int b,int c){ return (f2(a)+f2(b)+f2(c))。 }long f2(int x){ int m。 return (m=x*x)。}(2)分析程序,若在主函數(shù)中使用下列幾種函數(shù),將會產(chǎn)生什么效果?A、f1(a+++1,a+++2,a+++3) 結(jié)果:B、f1(++a+1,++a+2,++a+3) 結(jié)果:C、f1(a+a++,a+a++,a+a++) 結(jié)果。 (3)考慮在何處插入輸出語句,可以測試下列內(nèi)容。A、參數(shù)傳遞是否正確。 修改程序如下: includemain(){ int a=0。 printf(%1d,f1(a+a++,a+a++,a+a++))。}long f1(int a,int b,int c){ printf(a=%d,b=%d,c=%d,a,b,c)。 return (f2(a)+f2(b)+f2(c))。 }long f2(int x){ int m。 printf(x=%d\n,x)。 return (m=x*x)。}B、函數(shù)返回值是否正確。 程序修改如下:includemain(){ int a=0。 printf(%1d,f1(a+2,a+4,a+6))。}long f1(int a,int b,int c){ printf(f2(a)=%d\nf2(b)=%d\nf2(c)=%d\n,f2(a),f2(b),f2(c))。 return (f2(a)+f2(b)+f2(c))。 }long f2(int x){ int m。 m=x*x。 return (m)。} 實驗121..實驗?zāi)康呐c要求掌握如何正確地使用變量的存儲屬性。 閱讀并分析下面的實驗內(nèi)容。3. 實驗內(nèi)容和步驟(1) 分析下面的C語言程序,找出其中的錯誤,并分析原因。/******/int last(void)。int new(int)。int resert(void)。extern int i=1。main (void){ int i,j。 i=reset()。 for(j=1。j=3。j++) { printf(i=%d\t j=%d\n,i,j)。 printf(next(i)=%d\t,next(i))。 printf(last(i)=%d\t,last(i))。 printf(new(i+j)=%d\n,new(i+j))。 }int next(void){ return(i++)。}}/******/static int i=10。fast(void){return(i=1)。}new(int i){ static int j=5。 return(i=j+=++i)。}/******/extern int i。reset(){return(i)。}(2)給出以下的程序框架,請根據(jù)程序框架分析程序的的功能。/**********/includeincludevoid main(){ extern a(),b(),c(),d(),e(),f()。 a()。 b()。 c()。 d()。 e()。 f()。}/**********/a(){ int x=1。}int y=2。b(){ static int w=3。}c(){}/**********/included(){}extern int y。e(){}f(){ int v=4。}老師:很抱歉!實驗12我是真的不會。請諒解!實驗131..實驗?zāi)康呐c要求(1)掌握數(shù)組定義的正確方法。(2)了解數(shù)組元素的存儲規(guī)律。 準(zhǔn)備下面的實驗內(nèi)容。4. 實驗內(nèi)容和步驟(1) 編寫程序來測試下面的數(shù)組定義是否正確。 A、 includemain(){int n。scanf(%d\n,amp。n)。float a[n]。.......}該程序錯誤:數(shù)組的元素個數(shù)只能是確定的數(shù)目,不可以定義為變量。B、includemain(){int n=10。float a[n]。......}該程序錯誤:數(shù)組的元素個數(shù)只能是確定的數(shù)目,不可以定義為變量。C、includemain(){ const int n=10。float a[n]......}該程序錯誤:此程序雖然定義了n是一個不可改變的值,但是a[n]中的n只能是確定的正整數(shù)。D、includedefine M 10main(){float a[M]。......}該程序正確。E、includedefine M 10define N 2main(){float a[M+N]。}該程序正確。(2) 運行下面的C語言程序。運行結(jié)果可以說明什么問題?includemain(){ int num[5]={1,2,3,4,5,}。 int i。 for(i=0。i5。i++) printf(%4d,num[i])。}運行結(jié)果:(3) 請上機運行這個程序,指出它的功能和運行結(jié)果。includechar s[]={39。\t39。,39。039。,39。\n39。,39。|39。,39。39。,39。\n39。,39。\n39。,39。/39。,39。*39。,39。\n39。,(213 lines deleted)0}。/* *The string is a* representation of the body* of this program from 39。039。* to the end*/main(){ int i 。 printf(char \ts[]={\n)。 for(i=0。s[i]。i++) printf(\t%d,\n,s[i])。 printf(%s,s)。}功能:以 int 和 string 形式輸出同一個數(shù)組。從輸出結(jié)果可以知道給同一個數(shù)組定義不同的類型將會輸出不同的結(jié)果。輸出結(jié)果:實驗141..實驗?zāi)康呐c要求熟悉指針的正確用法。5. 實驗內(nèi)容與步驟(1) 調(diào)試下面程序,指出出現(xiàn)錯誤的原因。main(){ int x=10,y=5,*px,*py。 px=py。 px=amp。x。 py=amp。y。 printf(*px=%d,*py=%d\n,*px,*py)。} 調(diào)試結(jié)果: includemain(){ int x=10,y=5,*px,*py。 px=py。 px=amp。x。 py=amp。y。 printf(*px=%d,*py=%d\n,*px,*py)。} 運行結(jié)果: 第一個程序錯誤原因:缺少“include”。(2)下面程序試圖有如下運行結(jié)果。Which style you want to:Capital(c) or uncapital(u)。cCOMPUTERWhich style you want to:Capital(c) or uncapital(u)。uComputer 調(diào)試下面程序使其有如上執(zhí)行結(jié)果 includemain(){ char *s。 char c。 printf(which style you want to:ln)。 printf(capital(c)or uncapital(u):)。 c=getchar()。 if(c=39。c39。) strcpy (s,COMPUTER)。 else strcpy(s,puter)。 put(s)。}錯誤信息: 調(diào)試后程序:includemain(){ char *s[8]。 char c。 printf(which style you want to:\n)。 printf(capital(c)or uncapital(u):)。 c=getchar()。 if(c=39。c39。) strcpy (s,COMPUTER)。 if(c=39。u39。) strcpy (s,puter)。 puts(s)。 }運行結(jié)果: (2) 調(diào)試下面程序。includemain(){float a。float*pascanf(%f,amp
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1