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

正文內(nèi)容

c程序設(shè)計(第四版)(譚浩強)完整版課后習(xí)題答案-在線瀏覽

2024-08-08 08:22本頁面
  

【正文】 float output_cen。 //函數(shù)的功能體. return output_cen。 output_fah=()*input_cen+32。}int main(){ int choice。 //局部變量的調(diào)用及參數(shù)傳遞. printf(F_to_C press 1 and C_to_F press 2 !\n)。choice)。 scanf(%f,amp。 //這個是主函數(shù)定義的變量,雖然和調(diào)用函數(shù)同名.output_cen=F_to_C(input_fah)。 } if(choice==2) { printf(Please input centigrade :)。input_cen)。 printf(The Centigrade is %d , and the Fahrenheit is %d .,(int)input_cen,(int)output_fah)。}P038 計算存款利息(關(guān)于精度問題).include int main(){ float p0=1000,r1=,r2=,r3=,p1,p2,p3。 p2=p0*(1+r2)。 printf(p1=%f\np2=%f\np3=%f\n,p1,p2,p3)。}P055 大寫轉(zhuǎn)換成小寫include int main() //小寫范圍是97122,大寫范圍是6590,.{ char c1, c2。A39。 printf(%c %d,c2,c2)。}P059 給出三角形邊長,算出面積.include include int main() { double a=, b=, c=, s, area。 area=sqrt(s*(sa)*(sb)*(sc))。 //默認(rèn)可以組成三角形. return 0。 scanf(%lf %lf %lf,amp。b,amp。 disc=b*b4*a*c。 q=sqrt(disc)/(*a)。 x2=pq。 return 0。 //1是整型,. printf(%.9f\n,a/3)。}P072 float型數(shù)據(jù)的有效位數(shù).include include int main(){ float a。 printf(%f\n,a)。}P078 使用putchar函數(shù)輸出.include include int main(){ char a=39。,b=39。,c=39。 putchar(a)。 putchar(c)。\n39。 putchar(101)。 return 0。 a=getchar()。 c=getchar()。 putchar(b)。 //這也是基本回顯的C程序代碼. putchar(39。)。}P081 getchar得到大寫,putchar輸出小寫.include include int main(){ char a,b。 b=a+32。 putchar(39。)。}P082 國民生產(chǎn)總值10年后的增長倍數(shù).include include int main(){ double p,r=,n=10。 //這是數(shù)學(xué)函數(shù), pow(x,y)計算x的y次方. printf(P is %lf when 10 years later .\n,p)。 //.}P082 求各種存款的利息數(shù).include include int main(){ double p,r,n。 printf(5 years is %lf !\n,p)。 p=(p*(1+3*))。 //,這是先二年,再三年的. p=(1000*(1+3*))。 printf(5 years is %lf !\n,p)。 printf(5 years is %lf !\n,p)。 printf(5 years is %lf !\n,p)。 }P083 求幾個月要以還貸.include include int main(){ double m,r=,d=300000,p=6000。 printf(%.1lf,m)。}P084 字母密碼轉(zhuǎn)換,調(diào)用函數(shù)及臨界處理.include char printcode(char f){ if(((int)f86amp。(int)f91)||((int)f118amp。(int)f123)) { return(f26+4)。 }}int main(){ char a,b,c,d,e。 a=getchar()。 c=getchar()。 e=getchar()。 putchar(putcharcode(a))。 putchar(putcharcode(c))。 putchar(putcharcode(e))。 //注意理解自定義函數(shù)的定義,使用,及形參實參的流向. //p84的是計算問題,自己看著辦,最后要求小數(shù)點后兩位,用的是%.2lf 來實現(xiàn),因為沒有要求實部,. //p84的是定義問題,第一問,兩者都行,但是定義字母時,scanf要寫%c來獲取,而定義數(shù)值時則要用%d來獲取. // 第二問,putchar貌似只能輸出字符,字符,有木有!!!字符啊!!盡管它的參數(shù)可以是putchar(39。),效果是輸出字符A啊. // 第三問,出現(xiàn)任何及無條件,那么答案明顯是否.可以轉(zhuǎn)換,但要在某此條件下,例如輸出和讀入時,%c是字母,而%d是數(shù)值,看著辦.}選擇結(jié)構(gòu)程序設(shè)計P086 一無二次方程求根的二分支.include include int main() { double a,b,c,disc,x1,x2,p,q。a,amp。c)。 if(disc0) //這是選擇結(jié)構(gòu)和其判斷條件的示例. printf(This equation hasn39。 else { p=b/(*a)。 x1=p+q。 printf(x1=%\nx2=%,x1,x2)。}P087 二個數(shù)按大小輸出.include int main() //此程序代表按大小順序輸出.{ float a,b,t。a,amp。 //出錯時,. if(ab) { t=a。 b=t。 return 0。 scanf(%f %f %f,amp。b,amp。 if(ab) //此處執(zhí)行后,a為小者. { t=a。 b=t。 a=c。 } if(bc) //上面已經(jīng)搞定a是最小者,現(xiàn)在對比得出次小者,并且已經(jīng)歸到變量中. { t=b。 c=t。 return 0。 scanf(%c,amp。 ch=(ch=39。amp。ch=39。)?(ch+32):ch。 return 0。 scanf(%d,amp。 if(x=0) { if(x0) //這個范圍要基于x=0來判斷. { y=1。 } } else //這個是x0的范圍. { y=1。 return 0。 scanf(%c,amp。 printf(Your score:)。a39。break。b39。break。c39。break。d39。break。 } return 0。}void action2(int x,int y){ printf(x*y=%d\n,x*y)。 int a=15,b=23。 switch(ch) { case39。: case39。:action1(a,b)。 //a,A共用一個執(zhí)行語句. case39。: case39。:action2(a,b)。 default:putchar(39。)。\a39。}P106 用if的分支來做閏年問題include int main(){ int year,leap。 scanf(%d,amp。 if(year%4==0) //400年里,在100個可除盡4的年里計算,以下是在全范圍內(nèi)計算. { if(year%100==0) //既是100個內(nèi)的,又是可以除盡100的,算是且. { if(year%400==0) //相當(dāng)于且了兩次,只余下唯一一個. { leap=1。 } } else //這里的范圍是(year%4==0)amp。(year%100!=0) { leap=1。 } if(leap) { printf(%d is ,year)。 } printf(a leap year !)。}P108 一元二次等式的全計算過程.include include int main(){ double a,b,c,disc,x1,x2,realpart,imagpart。a,amp。c)。 if(fabs(a)=1e6) //fabs是絕對值, le6,即是的負(fù)六次方,接近或是等于零. { printf(is not a quadratic !\n)。 } else { disc=b*b4*a*c。 } else { if(disc1e6) { x1=(b+sqrt(disc))/(2*a)。 printf(has distinct real roots : %lf and %lf \n,x1,x2)。 imagpart=sqrt(disc)/(2*a)。 printf(%lf + %lfi\n,realpart,imagpart)。 } } } return 0。 printf(p,w,s\n)。p,amp。s)。 f=p*w*s*(1d)。 } else if(s500) { d=。 printf(%lf,f)。 f=p*w*s*(1d)。 } else if(s2000) { d=。 printf(%lf,f)。 f=p*w*s*(1d)。 } else { d=。 printf(%lf,f)。}P0112 鍵盤輸入三個數(shù),輸出最大者.include int mina,mida,maxa。 if(ab) //凡是比較中,大于號代表升序排列. { m=a。 b=m。 a=c。 } if(bc) { m=a。 c=m。 //此排序后,a,b,.}int main(){ int a,b,c。 scanf(%d %d %d,amp。b,amp。 printf(The max is %d !\n,max(a,b,c))。} P0112 一個小于1000的數(shù),有判定條件.include include int main(){ double a,b。 scanf(%lf,amp。 if(a1000) { b=sqrt(a)。 //控制蜂鳴聲 printf(Please input a number again :)。a)。 } printf(%.0lf,b)。}P0112 一個不多于5位的數(shù),按條件輸出.include include int main(){ int i,a,b[4],count=0。 //意思是五位數(shù)以內(nèi). scanf(%d,amp。 for(i=0。i++) { b[i]=a%10。 // /10后得到的結(jié)果去掉了個數(shù). if(b[i]!=0) { count=count+1。 printf(分別輸出每一位數(shù)字,如下:)。i=0。 } printf(\n)。 for(i=0。i++) { printf(%d,b[i])。 return 0。 printf(Please input profit amount :)。a)。 } else if(a=20) //以上面為基礎(chǔ),這已經(jīng)代表了1020間了!!! { b=1+(a10)*。 } else if(a=60) { b=1+++(a40)*。 } else //這里是大于100的. { b=1++++(a100)*。 return 0。 scanf(%lf,amp。 return (c)。 char c。\nB : 1020 。\nD : 4060 。\nF : 1001000 。 scanf(%c
點擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1