面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言——C第二版陳志泊 主編 王春玲 孟偉編著 課后編程題答案_第1頁(yè)
面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言——C第二版陳志泊 主編 王春玲 孟偉編著 課后編程題答案_第2頁(yè)
面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言——C第二版陳志泊 主編 王春玲 孟偉編著 課后編程題答案_第3頁(yè)
面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言——C第二版陳志泊 主編 王春玲 孟偉編著 課后編程題答案_第4頁(yè)
面向?qū)ο蟮某绦蛟O(shè)計(jì)語(yǔ)言——C第二版陳志泊 主編 王春玲 孟偉編著 課后編程題答案_第5頁(yè)
已閱讀5頁(yè),還剩29頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 C+第二單元課后編程題 /第一題#include <iostream.h>void main() float a,b,c; cout<<"請(qǐng)輸入三角形的三條邊長(zhǎng):"<<endl; cout<<"ta=" cin>>a; cout<<"tb=" cin>>b; cout<<"tc=" cin>>c; if(a<=0|b<=0|c<=0|(a+b<=c)|(a+c)<=b|(b+c

2、<=a) cout<<"此三條邊不能組成三角形!"<<endl; else if(a*a+b*b=c*c|a*a+c*c=b*b|b*b+c*c=a*a) cout<<"此三角形是直角三角三角形!"<<endl; if(a>b&&a>c) cout<<"此直角三角形的面積是:S=" <<b*c/2<<endl; else if(b>a&&b>c) cout<<"此直角三

3、角形的面積是:S=" <<a*c/2<<endl; else cout<<"此直角三角形的面積是:S=" <<a*b/2<<endl; else cout<<"此三角形不是直角三角形!"<<endl ; /第二題#include <iostream.h>void main() int length8,a8,b8 ; int max=0,min=0,m=0,n=0; cout<<"data typetmemory used(byt

4、es)(各種數(shù)據(jù)類(lèi)型的存儲(chǔ)長(zhǎng)度是 :)" length0=sizeof(short int); /獲取短整型長(zhǎng)度 cout<<"nshort intt"<<length0; length1=sizeof(int); /獲取整型長(zhǎng)度 cout<<"nint t"<<length1; length2=sizeof(long int); /獲取長(zhǎng)整型長(zhǎng)度 cout<<"nlong int t"<<length2; length3=sizeof(char); /

5、獲取字符型長(zhǎng)度 cout<<"nchar t" <<length3; length4=sizeof(float); /獲取單浮點(diǎn)型長(zhǎng)度 (單精度) cout<<"nfloat t"<<length4; length5=sizeof(double); /獲取雙浮點(diǎn)型長(zhǎng)度 (雙精度) cout<<"ndouble t"<<length5; length6=sizeof(long double); / 獲取長(zhǎng)雙浮點(diǎn)型長(zhǎng)度 (長(zhǎng)雙精度) cout<<"

6、;nlong doublet"<<length6; length7=sizeof(bool); /獲取布爾型長(zhǎng)度 cout<<"nbool t"<<length7<<endl; for(int i=0;i<8;i+) if (lengthi>lengthmax)/求取長(zhǎng)度最大的類(lèi)型的存取位置max=i;if (lengthi<lengthmin)/求取長(zhǎng)度最小的類(lèi)型的存取位置min=i; for(int j=0;j<8;j+) if(lengthmax=lengthj) am=j; m+; i

7、f(lengthmin=lengthj) bn=j; n+; m-; n-; cout<<"The longest length is from(存儲(chǔ)長(zhǎng)度最大的數(shù)據(jù)類(lèi)型是:) "<<endl; while(m>=0) max= am; switch (max) case 0:cout<<"short int"<<endl;break;case 1:cout<<"int"<<endl;break;case 2:cout<<"long in

8、t"<<endl;break;case 3:cout<<"char"<<endl;break;case 4:cout<<"float"<<endl;break;case 5:cout<<"double"<<endl;break;case 6:cout<<"long double"<<endl;break;case 7:cout<<"bool"<<endl;

9、 break; m-; cout<<"The shortest length is from(存儲(chǔ)長(zhǎng)度最小的數(shù)據(jù)類(lèi)型是 :) "<<endl; while(n>=0) min= bn; switch (min) case 0:cout<<"short int."<<endl;break;case 1:cout<<"int."<<endl;break;case 2:cout<<"long int"<<endl;bre

10、ak;case 3:cout<<"char"<<endl;break;case 4:cout<<"float"<<endl;break;case 5:cout<<"double"<<endl;break;case 6:cout<<"long double"<<endl;break;case 7:cout<<"bool"<<endl; break; n-; /第三題#includ

11、e<iostream> using namespace std; void main() double F,C; cout<<"請(qǐng)輸入一個(gè)華氏溫度:" <<"ntF=()" cin>>F; C=(F-32)*5/9; cout<<"轉(zhuǎn)換成的攝氏溫度為:"<<"ntC="<<C<<""<<endl; /第四題#include<iostream> using namespace s

12、td; void main() int x,i=0; int a100;/數(shù)組長(zhǎng)度100可以再增大 cout<<"請(qǐng)輸入一個(gè)十進(jìn)制正整數(shù):" <<endl; cin>>x; while(x>0)/x只能大于0,不能大于等于0(進(jìn)入死循環(huán)) ai=x%2; i+ ; x=x/2; i-;/把最后一次加的1減出去,實(shí)際沒(méi)存入數(shù) cout<<"轉(zhuǎn)化成的二進(jìn)制數(shù)為:"<<endl; while(i>=0) cout<<ai; i-; cout<<endl; C+第三單

13、元課后編程題/第一題#include<iostream.h>void main() int i,k=0,sum=0; int a50; for(i=1;i<=100;i+) if(i%3=0) ak=i; k+; k-; while(k>=0) sum+=ak; k-; cout<<"1到100所有3的倍數(shù)的數(shù)的和是:sum="<<sum<<endl; /第二題#include<iostream.h> void main() int i,k,N,sum1=0,sum2=0; cout<<&q

14、uot;輸入的整數(shù)總個(gè)數(shù)為:"<<endl; cin>>N; cout<<"請(qǐng)輸入要輸入的整數(shù):"<<endl; for( i=0;i<N;i+) cin>>k; if(k%2=0) sum1+=k; else sum2+=k; cout<<"輸入的所有整數(shù)中的所有偶數(shù)之和是:tsum1="<<sum1<<endl; cout<<"輸入的所有整數(shù)中的所有奇數(shù)之和是:tsum2="<<sum2<&

15、lt;endl; /第三題 #include<iostream.h> void main() int a,b,t; int r,x; cout<<"請(qǐng)輸入兩個(gè)正整數(shù):" cin>>a>>b; x = a * b; if (a < b) /替換,保證a為較大的數(shù) t = a; a = b; b = t; while (b != 0) r = a % b; a = b; b = r; cout<<"最大公約數(shù)為:"<<a<<endl;cout<<"

16、最小公倍數(shù)為:"<<x/a<<endl; /最小公倍數(shù)即為兩個(gè)數(shù)的乘積除以最大公約數(shù)/第四題#include<iostream.h>#include<math.h>void main() int a10,b10; int i,m=0,n=0,c,d,e;/f=0,g; cout<<"請(qǐng)輸入10個(gè)正整數(shù):"<<endl; for(i=0;i<10;i+) cin>>ai; m+=ai; c=m/10; for(i=0;i<10;i+) bi=(ai-c)*(ai-c);

17、n+=bi; / f+=abs(ai*ai-c*c); d=n/10; / g=f/10; e=(int)sqrt(d); cout<<"這10個(gè)正整數(shù)的平均值為:t"<<c<<endl; cout<<"這10個(gè)數(shù)的方差為: t"<<d<<endl; cout<<"這10個(gè)數(shù)的標(biāo)準(zhǔn)方差為: t"<<e<<endl; / cout<<f<<" "<<g<<endl

18、; /第五題#include<iostream.h>void main() char a4; int i; cout<<"請(qǐng)輸入4個(gè)字母:"<<endl; for(i=0;i<4;i+) cin>>ai; cout<<"反向輸出這4個(gè)字母為:"<<endl; i-; /用while時(shí)的語(yǔ)句 while(i>=0) / 用while時(shí)的語(yǔ)句 /for(i=3;i>=0; i-) cout<<ai<<" " i-; / 用wh

19、ile時(shí)的語(yǔ)句 (包括大括號(hào),for不需要) cout<<"n" /第六題#include<iostream.h>void main() int a10=0,1,2,3,4,5,6,7,8,9; int i,j,k; cout<<"所有的水仙花數(shù)為:"<<endl; for(i=1;i<10;i+) for(j=0;j<10;j+) for(k=0;k<10;k+) if( ai*100+aj*10+ak=(ai*ai*ai)+ (aj*aj*aj)+(ak*ak*ak) cout<

20、<ai<<aj<<ak<<endl; /第七題#include<iostream.h>void main() long double i,sum1=1,sum2=0; for(i=1;i<=50;i+) sum1 *=i; / cout<<sum1<<endl; sum2 +=sum1; cout<<"1!+2!+.+50!="<<sum2<<endl;/第八題#include<iostream.h>#include<math.h>

21、void main() float a,b,c,d; float x,x1,x2; cout<<"請(qǐng)輸入一元二次方程的二次項(xiàng)系數(shù),一次項(xiàng)系數(shù),常數(shù)項(xiàng):"<<endl; cout<<"ta=" cin>>a; cout<<"tb=" cin>>b; cout<<"tc=" cin>>c; d=b*b-4*a*c; if(a=0) cout<<"方程不是二次方程!"<<endl;

22、x=(float)-c)/b; cout<<"方程的解為:tx="<<x<<endl; else if(d=0) cout<<"方程有兩個(gè)相等的實(shí)根!"<<endl; x1=x2=(float)-b)/(2*a ); cout<<"方程兩個(gè)相等的實(shí)根是:tx1=x2="<<x1<<endl; else if(d>0) cout<<"方程有兩個(gè)不等的實(shí)根!"<<endl; x1=(-b+sqr

23、t(d)/(2*a); x2=(-b-sqrt(d)/(2*a); cout<<"方程兩個(gè)不等的實(shí)根分別是:tx1="<<x1<<"tx2="<<x2<<endl; else cout<<"方程無(wú)實(shí)根,但有兩個(gè)不相等的虛根!"<<endl; cout<<"方程兩個(gè)不等的虛根分別是:" <<endl; cout<<"tx1="<<(float)-b)/(2*a)<

24、;<"+"<<sqrt(-d)/(2*a)<<"i"<<endl; cout<<"tx2="<<(float)-b)/(2*a)<<"-"<<sqrt(-d)/(2*a)<<"i"<<endl; /第九題 #include<iostream.h> void main() int i,j,k; for(i=3;i>=0;i-) j=i; while(j>0) c

25、out<<" " j-; cout<<"" k=5-2*i; while(k>0) cout<<"#" k-; switch (i) case 0: case 1: case 2: cout<<""<<endl; break; case 3: cout<<endl; break; for(i=1;i<=3;i+) j=i; while(j>0) cout<<" " j-; cout<<

26、;"" k=5-2*i; while(k>0) cout<<"#" k-; switch (i) case 0: case 1: case 2: cout<<""<<endl; break; case 3: cout<<endl; break; /第十題#include <iostream.h>void main() int year,month,day; cout<<"請(qǐng)輸入年月日信息:"<<endl; cout<&l

27、t;"year=" cin>>year; cout<<"month=" cin>>month; cout<<"day=" cin>>day; while(month<1|month>12|day>31|day<1)|(month=4|month=6|month=9|month=11)&&day=31)|(month=2&&day>(28+(year%4=0&&year%100!=0)|(year%4

28、00=0) cout<<"您輸入有誤!請(qǐng)重新輸入年月日信息:"<<endl; cout<<"year=" cin>>year; cout<<"month=" cin>>month; cout<<"day=" cin>>day; switch(month) case 1: cout<<"這一天是:"<<year<<"年 的第 " <<d

29、ay<<" 天" <<endl; break; case 2: cout<<"這一天是:"<<year<<"年 的第 " <<31+day<<" 天" <<endl; break; case 3: cout<<"這一天是:"<<year<<"年 的第 " <<31+28+(year%4=0&&year%100!=0)|

30、(year%400=0)+day<<" 天" <<endl; break; case 4: cout<<"這一天是:"<<year<<"年 的第 " <<2*31+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 5: cout<<"這一天是:"<<year<<

31、"年 的第 " <<2*31+30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 6: cout<<"這一天是:"<<year<<"年 的第 " <<3*31+30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <&l

32、t;endl; break; case 7: cout<<"這一天是:"<<year<<"年 的第 " <<3*31+2*30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 8: cout<<"這一天是:"<<year<<"年 的第 " <<4*31+2*30+28+(

33、year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 9: cout<<"這一天是:"<<year<<"年 的第 " <<5*31+2*30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 10: cout<<

34、"這一天是:"<<year<<"年 的第 " <<5*31+3*30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; case 11: cout<<"這一天是:"<<year<<"年 的第 " <<6*31+3*30+28+(year%4=0&&year%100!=0)|(ye

35、ar%400=0)+day<<" 天" <<endl; break; case 12: cout<<"這一天是:"<<year<<"年 的第 " <<6*31+4*30+28+(year%4=0&&year%100!=0)|(year%400=0)+day<<" 天" <<endl; break; /第十一題#include<iostream.h>void main() float x,y;

36、cout<<"請(qǐng)輸入x的值:"<<endl<<"tx=" cin>>x; if( x<0) y=x; cout<<"ty="<<y<<endl; else if(x>10) y=4*x*x*x-x*x; cout<<"ty="<<y<<endl; else y=x*x; cout<<"ty="<<y<<endl; /第十二題#in

37、clude<iostream.h> void main() int i,chicken,rabbit;/n=0; for(i=0;i<=100;i+) chicken=i/2; while(100-i)%4=0) rabbit=(100-i)/4; / n+; cout<<"雞兔各有:"<<endl; cout<<"雞 chicken="<<chicken<<"只"<<"t" cout<<"兔 rabbi

38、t="<<rabbit<<"只"<<endl; break; /cout<<n<<endl; C+第四單元課后編程題/第一題#include<iostream.h>#include<math.h>float LiangDianJvLi(float x0,float y0,float x1,float y1) float x,y,D; x=x0-x1; y=y0-y1; D=sqrt(x*x+y*y); return D; void main() float ax,ay,bx,by;

39、 cout<<"請(qǐng)輸入a,b兩點(diǎn)的坐標(biāo)(數(shù)字間用空格隔開(kāi)):"<<endl<<"t" cin>>ax>>ay>>bx>>by; cout<<"請(qǐng)確認(rèn)一下兩點(diǎn)坐標(biāo):"<<endl<<"t" cout<<"a("<<ax<<","<<ay<<")"<<"t&qu

40、ot;<<"b("<<bx<<","<<by<<")"<<endl; cout<<"點(diǎn)a("<<ax<<","<<ay<<")"<<"到"<<"點(diǎn)b("<<bx<<","<<by<<")的距離是:"

41、;<<endl; cout<<"tD="<<LiangDianJvLi(ax,ay,bx,by)<<endl; /第二題#include<iostream.h>long JieCheng(long n) if(n=0|n=1)/(n=0) return 1; return JieCheng(n-1)*n;void main() long a,b,c; cout<<"請(qǐng)輸入a,b,c的值:"<<endl; cout<<"ta=" ; cin&

42、gt;>a; cout<<"tb=" cin>>b; cout<<"tc=" cin>>c; cout<<"a!+b!+c!的值是:"<<endl; cout<<"ta!+b!+c!="<<(JieCheng(a)+JieCheng(b)+JieCheng(c)<<endl; /第三題#include<iostream.h>#include<math.h>void HuiWenS

43、huZi(int);void main() int n; cout<<"請(qǐng)輸入一個(gè)整數(shù)(整數(shù)位數(shù)不超過(guò)50):"<<endl; cout<<"tn=" cin>>n; HuiWenShuZi(n);void HuiWenShuZi(int a) int b,d,i=1,j; int c51; b=a; d=abs(a);/輸入為0是,下面的while不執(zhí)行,但i仍然是1和輸入的是一位數(shù)字相同 while(d>0) ci=d%10; d=(d-ci)/10; i+; i-; if(i%2=0) j=i/

44、2;/當(dāng)輸入是一位數(shù)字時(shí),i=1,j=0,不執(zhí)行while,直接到最后一個(gè)else while(j>=1) if(cj=ci/2+1) j-; i+=2; else cout<<"t"<<b<<"不是回文數(shù)字!"<<endl; break; if(j=0) cout<<"t"<<b<<"是回文數(shù)字!"<<endl; else j=i/2; while(j>=1) if(cj=ci/2+2) j-; i+=2;

45、 else cout<<"t"<<b<<"不是回文數(shù)字!"<<endl; break; if(j=0) cout<<"t"<<b<<"是回文數(shù)字!"<<endl; /第四題#include<iostream.h>float Average(float,float,float);float Average(float,float,float,float);float Average(float,float,fl

46、oat,float,float); void main() int N; float a1,a2,a3,b1,b2,b3,b4,c1,c2,c3,c4,c5; cout<<"請(qǐng)輸入您總共選修的課程門(mén)數(shù):"<<endl<<"t" cin>>N; while(N!=3&&N!=4&&N!=5) cout<<"您輸入有誤,請(qǐng)重新輸入:"<<endl<<"t" cin>>N; if(N=3) co

47、ut<<"請(qǐng)輸入3門(mén)選修課的成績(jī):"<<endl<<"t" cin>>a1>>a2>>a3; cout<<"您3門(mén)選修課程的平均分為:"<<Average(a1,a2,a3)<<endl; else if(N=4) cout<<"請(qǐng)輸入4門(mén)選修課的成績(jī):"<<endl<<"t" cin>>b1>>b2>>b3>&

48、gt;b4; cout<<"您4門(mén)選修課程的平均分為:"<<Average(b1,b2,b3,b4)<<endl; else if(N=5) cout<<"請(qǐng)輸入5門(mén)選修課的成績(jī):"<<endl<<"t" cin>>c1>>c2>>c3>>c4>>c5; cout<<"您5門(mén)選修課程的平均分為:"<<Average(c1,c2,c3,c4,c5)<<

49、endl; float Average(float x1,float x2,float x3) float X; X=(x1+x2+x3)/3; return X; float Average(float y1,float y2,float y3,float y4) float Y; Y=(y1+y2+y3+y4)/4; return Y; float Average(float z1,float z2,float z3,float z4,float z5) float Z; Z=(z1+z2+z3+z4+z5)/5; return Z; /第五題/該程序采用遞歸的方法把整數(shù)轉(zhuǎn)化為字符串#in

50、clude <iostream>using namespace std;int main(void) int number; /變量 void IntToStr(int n);/函數(shù)原型 cout<<"請(qǐng)輸入一個(gè)整數(shù):" /數(shù)據(jù)獲取 cin>>number; cout<<"轉(zhuǎn)換結(jié)果是:"<<endl; cout<<"t"" ; if(number<0) /如果輸入的是負(fù)數(shù) cout<<"-"/輸出負(fù)號(hào) number=

51、-number;/轉(zhuǎn)換為正數(shù)解決 IntToStr(number);/調(diào)用遞歸函數(shù) cout<<"""<<endl; return 0;/*該函數(shù)用遞歸的方法把整數(shù)轉(zhuǎn)換成為字符串*/void IntToStr(int n) if(n/10)!=0)/如果N為1位數(shù)字,則輸出 IntToStr(n/10);/如果N不是1位整數(shù)則遞歸分析 cout<<(char)(48+n%10);/輸出該位數(shù)字/第六題#include<iostream.h> int j=0;void ZhuanHuan(int n) int i,m;

52、 m=n%10; / j=(j+m)*10; cout<<m; i=(n-m)/10; if(i>0) ZhuanHuan(i); void main()int a;cout<<"請(qǐng)輸入一個(gè)整數(shù):"<<endl;cin>>a;ZhuanHuan(a);cout<<endl;/cout<<j/10<<endl;/第七題#include<iostream.h>int Average1(int,int,int);float Average2(float,float,float);

53、 void main() int a1,a2,a3; float b1,b2,b3; int N; cout<<"您要輸入的3個(gè)數(shù)字是否全為整型或浮點(diǎn)型?"<<endl<<"請(qǐng)按情況選擇您要輸入的3個(gè)數(shù)的類(lèi)型的序號(hào):" <<endl; cout<<"t1. 3個(gè)數(shù)字全為整型!"<<endl<<"t2. 3個(gè)數(shù)字全為浮點(diǎn)型!"<<endl<<"t3. 3個(gè)數(shù)字整型、浮點(diǎn)型均有!"<&l

54、t;endl; cin>>N; while(N!=1&&N!=2&&N!=3) cout<<"您選擇有誤,請(qǐng)重新選擇:"<<endl; cin>>N; if(N=1) cout<<"請(qǐng)輸入3個(gè)數(shù)字(數(shù)字間用空格鍵隔開(kāi)):"<<endl<<"t" cin>>a1>>a2>>a3; cout<<"3個(gè)數(shù)字的平均值是:t"<<Average1(a1

55、,a2,a3)<<endl; else cout<<"請(qǐng)輸入3個(gè)數(shù)字(數(shù)字間用空格鍵隔開(kāi)):"<<endl<<"t" cin>>b1>>b2>>b3; cout<<"3個(gè)數(shù)字的平均值是:t"<<Average2(b1,b2,b3)<<endl; int Average1(int x1,int x2,int x3) int max,min,X; if(x1>x2) max=x1; min=x2; else max

56、=x2; min=x1; if(max>x3) cout<<"3個(gè)數(shù)字中的最大值是:t"<<max<<endl; if(x3>min) cout<<"3個(gè)數(shù)字中的最小值是:t"<<min<<endl; else cout<<"3個(gè)數(shù)字中的最小值是:t"<<x3<<endl; else cout<<"3個(gè)數(shù)字中的最大值是:t"<<x3<<endl; cout<

57、;<"3個(gè)數(shù)字中的最小值是:t"<<min<<endl; X=(x1+x2+x3)/3; return X; float Average2(float y1,float y2,float y3) float max,min,Y; if(y1>y2) max=y1; min=y2; else max=y2; min=y1; if(max>y3) cout<<"3個(gè)數(shù)字中的最大值是:t"<<max<<endl; if(y3>min) cout<<"3個(gè)數(shù)

58、字中的最小值是:t"<<min<<endl; else cout<<"3個(gè)數(shù)字中的最小值是:t"<<y3<<endl; else cout<<"3個(gè)數(shù)字中的最大值是:t"<<y3<<endl; cout<<"3個(gè)數(shù)字中的最小值是:t"<<min<<endl; Y=(y1+y2+y3)/3; return Y; /第七題(符合書(shū)上要求) #include<iostream.h> int

59、 IMax,IMin,X; float FMax,FMin,Y; void Average1(int,int,int); void Average2(float,float,float); void main() int a1,a2,a3; float b1,b2,b3; int N; cout<<"您要輸入的3個(gè)數(shù)字是否全為整型或浮點(diǎn)型?"<<endl<<"請(qǐng)按情況選擇您要輸入的3個(gè)數(shù)的類(lèi)型的序號(hào):" <<endl; cout<<"t1. 3個(gè)數(shù)字全為整型!"<<

60、;endl<<"t2. 3個(gè)數(shù)字全為浮點(diǎn)型!"<<endl<<"t3. 3個(gè)數(shù)字整型、浮點(diǎn)型均有!"<<endl; cin>>N; while(N!=1&&N!=2&&N!=3) cout<<"您選擇有誤,請(qǐng)重新選擇:"<<endl; cin>>N; if(N=1) cout<<"請(qǐng)輸入3個(gè)數(shù)字(數(shù)字間用空格鍵隔開(kāi)):"<<endl<<"t&q

61、uot; cin>>a1>>a2>>a3; Average1(a1,a2,a3); cout<<"3個(gè)數(shù)字中的最大值是:t"<<IMax<<endl; cout<<"3個(gè)數(shù)字中的最小值是:t"<<IMin<<endl; cout<<"3個(gè)數(shù)字的平均值是:t"<<X<<endl; else cout<<"請(qǐng)輸入3個(gè)數(shù)字(數(shù)字間用空格鍵隔開(kāi)):"<<endl<<"t" cin>>b1>>b2>>b3; Average2(b1,b2,b3); cout<<"3個(gè)數(shù)字中的最大值是:t"<<FMax<<endl; cout<<"3個(gè)數(shù)字中的最小值是:t"<<FMin<&l

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論