當前位置:首頁 » 招生排名 » c大學教程第7版答案

c大學教程第7版答案

發布時間: 2021-12-30 16:13:05

A. 《c大學教程》第五版 習題答案 為提供者追加200分

第四版的答案:

http://www.rayfile.com/zh-cn/files/c4d7ca40-8d1e-11dd-9634-0019d11a795f/

B. C語言程序設計教程(李含光鄭關勝編著清華大學出版社)課後習題答案

http://ishare.iask.sina.com.cn/search.php?key=C%D3%EF%D1%D4%B3%CC%D0%F2%C9%E8%BC%C6%BD%CC%B3%CC+%C7%E5%BB%AA%B4%F3%D1%A7%B3%F6%B0%E6%C9%E7&format=你去這上邊看看吧,隨便申個號就能下

C. c語言大學實用教程第三版答案第四章4.2(7)

能把照片拍下來么。

D. 大學c語言實用教程(清華大學出版社)課後答案

答案沒有,不過我有視頻教程,不知道你需要不,因為我是自學,我現在就內在看,感覺容還不錯。一聽就能聽懂的那種,感覺比較適合我這樣入門剛學的人。最吸引的地方就是講的難理解的概念講的特別好,用形象比喻舉例講概念,比如變數比喻成裝東西的盒子,我一下子就理解了變數賦值為什麼是從右往左。還有很多這樣類似的比喻。比我之前看的什麼郝斌曾怡金文的晦澀難懂的都好多了。

E. 新視野大學英語讀寫教程第二冊第七單元答案

Vocabulary III. 1.react 2.tense 3.recommended 4.destructive 5. perceive 6.emphasis 7.stirred 8.priority 9.attributed 10. stimulate IV. 1. blow his top 2. Among other things 3. take charge of 4. put emphasis on 5. is attributed to 6. from my viewpoint 7. substituted low-fat oil for butter 8.cut down on 9. keep your audience in mind 10. out of control
V. 1.N 2.E 3.G 4.J 5.I 6.A 7.C 8.L 9.D 10.O Word Building
VI. 1.endless 2. thoughtful 3. harmful 4. restless 5.beautiful 6.successful 7.fearless 8.joyful VII. realize privatize characterize socialize nationalize economize normalize criticize 1.nationalized 2.criticized 3.normalized 4.economize 5.realized 6.socializing 7.privatized 8.characterizes Sentence structure
VIII. 1.When you are studying abroad,misunderstandings can result from cultural differences, among ohter things. 2.Online learning requires, among other things, commitment and discipline to keep up with the flow of the course. 3.The research work was severely criticized for its poor management, among other things. 4.They discussed, among other things, the future of the oil instry. 5.The article shows, among other things, the negative effects of generation gap between parents and children. IX. 1.The more often I practice, the better I play. 2.The higher we got up in the air, the colder it became. 3.The more carbon the steel contains and the quicker the cooling is,the harder the steel becomes. 4.The more I thought about his suggestion, the more doubtful I became. 5.The more he eats,the fatter he becomes. Translation X. 1.At the meeting they discussed, among other things, the present economic situation. 2.The more I learned about the nature,the more absorbed I became in its mystery. 3.The doctor recommends that those stressed people should try something new,interesting and challenging in order to give their negative feelings an outlet. 4.The teacher gives more homework to the student who has bad grades instead of cutting it down. 5.By contrast,American parents are more likely to attribute their children's success to natural talent. 6.One of a teacher's priorities is to stimulate students' interests and their creativity.
XI. 1.初了其他內容,他的研究還牽涉到發展中國家與愛滋病的斗爭. 2.這些人明白了他們的服務越好,他們就掙得越多. 3.盡管父親似乎憂慮不安,但蘇珊感覺不到他在表情或行動上有什麼變化. 4.能獲得多少經濟資助已成為學生選擇上哪所學校的更重要的因素. 5.她已經減少了外出和買衣服的花費,但她還是沒錢開始還債. 6.控制壓力的方法之一是認識到生活中有很多事情是我們無法掌控的. CLOZE XII. 1.D 2.A 3.D 4.C 5.D 6.B 7.B 8.C 9.B 10.B 11.D 12.B 13.C 14.C 15.B Section B Comprehension of the Text II. 1. F 2.F 3.T 4.F 5.T 6.F 7.F 8.T Vocabulary III. 1.constant 2.ambition 3.consequence 4.evident 5. summarize 6.welfare 7.schele 8.attaining 9.loyal 10.indispensable IV. 1. There isn't anything to do other than wait to see what will happen. 2. Althought Bill was going to the movies, he told Joe to the contrary. 3. I wonder who it was that defined man as a rational animal. 4. Traveling in that country isn't necessary expensive;you can find reasonably priced hotels and restaurants. 5. Janet tends to get angry if you bother her. 6. I would rather walk there than go by bus. 7. She was held for twenty days and at times she feared for her life. 8. He's been burning the midnight oil for a week now, getting ready for finals. 9. For many people the only possible way to escape from poverty is to move to other countries. 10. Born in Milan, he dropped out of university to devote himself to music.

F. c語言程序設計能力教程答案

1 【C語言】《C語言程序設計教程(第二版)》習題答案

說 明
1. 本文所指的《C語言程序設計教程(第二版)》是李鳳霞主編、北京理
工大學出版社出版的,綠皮。

2 第1章 程序設計基礎知識
一、單項選擇題(第23頁)
1-4.CBBC 5-8.DACA

二、填空題(第24頁)
1.判斷條件 2.面向過程編程 3.結構化 4.程序 5.面向對象的程序設計語言 7.有窮性 8.直到型循環 9.演算法 10.可讀性 11.模塊化 12.對問題的分析和模塊的劃分

三、應用題(第24頁)
2.源程序:
main()
{int i,j,k; /* i:公雞數,j:母雞數,k:小雞數的1/3 */ <br>printf("cock hen chick\n"); <br>for(i=1;i<=20;i++) <br>for(j=1;j<=33;j++) <br>for(k=1;k<=33;k++) <br>if (i+j+k*3==100&&i*5+j*3+k==100) <br>printf(" %d %d %d\n",i,j,k*3);}
執行結果:
cock hen chick
4 18 78
8 11 81
12 4 84
3.現計算斐波那契數列的前20項。
遞推法 源程序:
main()
{long a,b;int i; <br>a=b=1; <br>for(i=1;i<=10;i++) /*要計算前30項,把10改為15。*/ <br>{printf("%8ld%8ld",a,b); <br>a=a+b;b=b+a;}}
遞歸法 源程序:
main()
{int i; <br>for(i=0;i<=19;i++) <br>printf("%8d",fib(i));}
fib(int i)
{return(i<=1?1:fib(i-1)+fib(i-2));}
執行結果:
1 1 2 3 5 8 13 21 34 55
89 144 233 377 610 987 1597 2584 4181 6765
4.源程序:
#include "math.h";
main()
{double x,x0,deltax; <br>x=1.5; <br>do {x0=pow(x+1,1./3); <br>deltax=fabs(x0-x); <br>x=x0; <br>}while(deltax>1e-12);
printf("%.10f\n",x);}
執行結果:
1.3247179572
5.源程序略。(分子、分母均構成斐波那契數列)
結果是32.66026079864
6.源程序:
main()
{int a,b,c,m; <br>printf("Please input a,b and c:"); <br>scanf("%d %d %d",&a,&b,&c); <br>if(a<b){m=a;a=b;b=m;}
if(a<c){m=a;a=c;c=m;}
if(b<c){m=b;b=c;c=m;}
printf("%d %d %d\n",a,b,c);}
執行結果:
Please input a,b and c:123 456 789
789 456 123
7.源程序:
main()
{int a; <br>scanf("%d",&a); <br>printf(a%21==0?"Yes":"No");}
執行結果:
42
Yes

3 第2章 C語言概述
一、單項選擇題(第34頁)
1-4.BDCB 5-8.AABC

二、填空題(第35頁)
1.主 2.C編譯系統 3.函數 函數 4.輸入輸出 5.頭 6. .OBJ 7.庫函數 8.文本

三、應用題(第36頁)
5.sizeof是關鍵字,stru、_aoto、file、m_i_n、hello、ABC、SIN90、x1234、until、cos2x、s_3是標識符。
8.源程序:
main()
{int a,b,c; <br>scanf("%d %d",&a,&b); <br>c=a;a=b;b=c; <br>printf("%d %d",a,b);}
執行結果:
12 34
34 12

4 第3章 數據類型與運算規則
一、單項選擇題(第75頁)
1-5.DBACC 6-10.DBDBC 11-15.ADCCC 16-20.CBCCD 21-25.ADDBC 26-27.AB

二、填空題(第77頁)
1.補碼 2.±(10^-308~10^308) 3.int(整數) 4.單目 自右相左 5.函數調用 6.a或b 7.1 8.65,89

三、應用題(第78頁)
1.10 9
2.執行結果:
11
0
0
12
1

5 第4章 順序結構程序設計
一、單項選擇題(第90頁)
1-5.DCDAD 6-10.BACBB

二、填空題(第91頁)
1.一 ;2. 5.169000 3.(1)-2002500 (2)I=-200,j=2500 (3)i=-200
j=2500 4.a=98,b=765.000000,c=4321.000000 5.略 6.0,0,3 7.3 8.scanf("%lf%lf%lf",&a,&b,&c); 9. 13 13.000000,13.000000 10.a=a^c;c=c^a;a=a^c;(這種演算法不破壞b的值,也不用定義中間變數。)

三、編程題(第92頁)
1.仿照教材第27頁例2-1。
2.源程序:
main()
{int h,m; <br>scanf("%d:%d",&h,&m); <br>printf("%d\n",h*60+m);}
執行結果:
9:23
563
3.源程序:
main()
{int a[]={-10,0,15,34},i;
for(i=0;i<=3;i++)
printf("%d\370C=%g\370F\t",a[i],a[i]*1.8+32);}
執行結果:
-10℃=14°F 0℃=32°F 15℃=59°F 34℃=93.2°F
4.源程序:
main()
{double pi=3.14159265358979,r=5; <br>printf("r=%lg A=%.10lf S=%.10lf\n",r,2*pi*r,pi*pi*r);}
執行結果:
r=5 A=31.4159265359 S=49.3480220054
5.源程序:
#include "math.h";
main()
{double a,b,c; <br>scanf("%lf%lf%lf",&a,&b,&c); <br>if (a+b>c&&a+c>b&&b+c>a) <br>{double s=(a+b+c)/2; <br>printf("SS=%.10lf\n",sqrt(s*(s-a)*(s-b)*(s-c)));}
else printf("Data error!");}
執行結果:
4 5 6
SS=9.9215674165
6.源程序:
main()
{int a=3,b=4,c=5;float d=1.2,e=2.23,f=-43.56; <br>printf("a=%3d,b=%-4d,c=**%d\nd=%g\ne=%6.2f\nf=%-10.4f**\n",a,b,c,d,e,f);}
7.源程序:
main()
{int a,b,c,m; <br>scanf("%d %d %d",&a,&b,&c); <br>m=a;a=b;b=c;c=m; <br>printf("%d %d %d\n",a,b,c);}
執行結果:
5 6 7
6 7 5
8.源程序:
main()
{int a,b,c; <br>scanf("%d %d %d",&a,&b,&c); <br>printf("average of %d,%d and %d is %.2f\n",a,b,c,(a+b+c)/3.); <br>執行結果: <br>6 7 9 <br>average of 6,7 and 9 is 7.33 <br>9.不能。修改後的源程序如下: <br>main() <br>{int a,b,c,x,y; <br>scanf("%d %d %d",&a,&b,&c); <br>x=a*b;y=x*c; <br>printf("a=%d,b=%d,c=%d\n",a,b,c); <br>printf("x=%d,y=%d\n",x,y);}

6 第5章 選擇結構程序設計
一、單項選擇題(第113頁)
1-4.DCBB 5-8.DABD

二、填空題(第115頁)
1.非0 0 2.k==0
3.if (abs(x)>4) printf("%d",x);else printf("error!");
4.if((x>=1&&x<=10||x>=200&&x<=210)&&x&1)printf("%d",x);
5.k=1 (原題最後一行漏了個d,如果認為原題正確,則輸出k=%。)
6. 8! Right!11 7.$$$a=0 8.a=2,b=1

三、編程題(第116頁)
1.有錯。正確的程序如下:
main()
{int a,b,c; <br>scanf("%d,%d,%d",&a,&b,&c); <br>printf("min=%d\n",a>b?b>c?c:b:a>c?c:a);}
2.源程序:
main()
{unsigned long a; <br>scanf("%ld",&a); <br>for(;a;printf("%d",a%10),a/=10);}
執行結果:
12345
54321
3.(1)源程序:
main()
{int x,y; <br>scanf("%d",&x); <br>if (x>-5&&x<0)y=x; <br>if (x>=0&&x<5)y=x-1; <br>if (x>=5&&x<10)y=x+1; <br>printf("%d\n",y);}
(2)源程序:
main()
{int x,y; <br>scanf("%d",&x); <br>if(x<10) if(x>-5) if(x>=0) if(x>=5)y=x+1; <br>else y=x-1; else y=x; <br>printf("%d\n",y);}
(3)源程序:
main()
{int x,y; <br>scanf("%d",&x); <br>if(x<10) if(x>=5)y=x+1; <br>else if(x>=0)y=x-1; <br>else if(x>-5)y=x; <br>printf("%d\n",y);}
(4)源程序:
main()
{int x,y; <br>scanf("%d",&x); <br>switch(x/5) <br>{case -1:if(x!=-5)y=x;break; <br>case 0:y=x-1;break; <br>case 1:y=x+1;}
printf("%d\n",y);}
4.本題為了避免考慮每月的天數及閏年等問題,故採用面向對象的程序設計。
現給出Delphi源程序和C++ Builder源程序。
Delphi源程序:
procere TForm1.Button1Click(Sender: TObject);
begin
edit3.Text:=format('%.0f天',[strtodate(edit2.text) -strtodate(edit1.text)]);
end;
procere TForm1.FormCreate(Sender: TObject);
begin
Edit2.Text:=datetostr(now);
button1click(form1)
end;
C++ Builder源程序:
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Edit3->Text=IntToStr(StrToDate(Edit2->Text)-StrToDate(Edit1->Text))+"天";
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Edit2->Text=DateToStr(Now());
Button1Click(Form1);
}
執行結果:(運行於Windows下) http://img378.photo.163.com/nxgt/41463572/1219713927.jpg

5.源程序:
main()
{unsigned a,b,c; <br>printf("請輸入三個整數:"); <br>scanf("%d %d %d",&a,&b,&c); <br>if(a&&b&&c&&a==b&&a==c)printf("構成等邊三角形\n"); <br>else if(a+b>c&&a+c>b&&b+c>a) <br>if(a==b||a==c||b==c)printf("構成等腰三角形\n"); <br>else printf("構成一般三角形\n"); <br>else printf("不能構成三角形\n");}
執行結果:
請輸入三個整數:5 6 5
構成等腰三角形
6.源程序:
main()
{int x,y; <br>scanf("%d",&x); <br>if(x<20)y=1; <br>else switch(x/60) <br>{case 0:y=x/10;break; <br>default:y=6;}
printf("x=%d,y=%d\n",x,y);}
7.源程序:
main()
{unsigned m;float n; <br>scanf("%d",&m); <br>if(m<100)n=0; <br>else if(m>600)n=0.06; <br>else n=(m/100+0.5)/100; <br>printf("%d %.2f %.2f\n",m,m*(1-n),m*n);}
執行結果:
450
450 429.75 20.25
8. 2171天(起始日期和終止日期均算在內)
本題可利用第4小題編好的程序進行計算。把起始日期和終止日期分別打入「生日」和「今日」欄內,單擊「實足年齡」按鈕,將所得到的天數再加上1天即可。
9.源程序:
#include "math.h";
main()
{unsigned long i; <br>scanf("%ld",&i); <br>printf("%ld %d\n",i%10,(int)log10(i)+1);}
執行結果:
99887
7 5
10.源程序:
main()
{unsigned long i;unsigned j[10],m=0; <br>scanf("%ld",&i); <br>for(;i;){j[m++]=(i+2)%10;i/=10;}
for(;m;m--)i=i*10+j[m-1];
printf("%ld\n",i);}
執行結果:
6987
8109
(註:要加密的數值不能是0或以0開頭。如果要以0開頭需用字元串而不能是整數。)

7 第6章 循環結構程序設計
一、單項選擇題(第142頁)
1-4.BCCB 5-8.CBCA

二、填空題(第143頁)
1.原題可能有誤。如無誤,是死循環 2.原題有誤。如果把b=1後面的逗號改為分號,則結果是8。 3.20 4.11 5. 2.400000 6.*#*#*#$ 7.8 5 2 8.①d=1.0 ②++k ③k<=n 9.①x>=0 ②x<amin

三、編程題(第145頁)
1. 源程序:
main()
{int i=1,sum=i; <br>while(i<101){sum+=i=-i-2;sum+=i=-i+2;}
printf("%d\n",sum);}
執行結果:
51
2.源程序:
main()
{double p=0,n=0,f;int i; <br>for(i=1;i<=10;i++) <br>{scanf("%lf",&f); <br>if (f>0)p+=f; else n+=f;}
printf("%lf %lf %lf\n",p,n,p+n);}
3.源程序:
main()
{unsigned a; <br>scanf("%ld",&a); <br>for (;a;printf("%d,",a%10),a/=10); <br>printf("\b \n");}
執行結果:
23456
6,5,4,3,2
4.源程序:
main()
{unsigned long a,b,c,i; <br>scanf("%ld%ld",&a,&b); <br>c=a%1000; <br>for(i=1;i<b;i++)c=c*a%1000; <br>if(c<100)printf("0"); <br>if(c<10)printf("0"); <br>printf("%ld\n",c);}
執行結果:
129 57
009
5.略
6.原題提供的計算e的公式有誤(前面漏了一項1)。正確的公式是e= 1 + 1 + 1/2! + 1/3! + … + 1/n! + …
(1)源程序:
main()
{double e=1,f=1;int n; <br>for(n=1;n<=20;n++){f/=n;e+=f;}
printf("e=%.14lf\n",e);}
執行結果:
e=2.71828182845905
(2)源程序:
main()
{double e=1,f=1;int n; <br>for(n=1;f>1e-4;n++){f/=n;e+=f;}
printf("e=%.4f\n",e);}
執行結果:
e=2.7183
7.源程序:
main()
{unsigned long a=0,b=1,c=0;int i,d; <br>scanf("%d",&d); <br>for (i=1;i<=(d+2)/3;i++) <br>printf("%10ld%10ld%10ld",a,b,(a+=b+c,b+=c+a,c+=a+b));}
本題還可以用遞歸演算法(效率很低),源程序如下:
unsigned long fun(int i)
{return i<=3?i:fun(i-1)+fun(i-2)+fun(i-3);}
main()
{int i,d; scanf("%d",&d); <br>for(i=1;i<=d;i++) <br>printf("%10ld",fun(i));}
執行結果:
15
1 2 3 6 11 20 37 68
125 230 423 778 1431 2632 4841
8.源程序:
main()
{int i; <br>for(i=1010;i<=9876;i+=2) <br>if(i/100%11&&i%100%11&&i/10%100%11&&i/1000!=i%10&&i/1000!=i/10%10&&i/100%10!=i%10)printf(" %d",i);}
執行結果:
1024 1026 1028 1032 1034 1036 …… …… 9874 9876
9.源程序:
main()
{int i,j,k; <br>printf("apple watermelon pear\n"); <br>for(i=1;i<=100;i++) <br>for(j=1;j<=10;j++) <br>if((k=100-i-j)*2==400-i*4-j*40) <br>printf("%4d%7d%9d\n",i,j,k);}
執行結果:
apple watermelon pear
5 5 90
24 4 72
43 3 54
62 2 36
81 1 18
10.源程序:
#include "stdio.h";
#define N 4 /* N為階數,可以改為其他正整數 */
main()
{int m=N*2,i,j; <br>for(i=1;i<m;printf("\n"),i++) <br>for(j=1;j<m; <br>putchar(N-abs(i-N)<=abs(j++-N)?' ':'*'));}
如果把N值改為5,則執行結果如下:
*
***
*****
*******
*********
*******
*****
***
*

G. C語言大學實用教程第二版(蘇小紅編)課後答案

http://wenku..com/view/f589e3c9a1c7aa00b52acbf8.html

H. 大學英語綜合教程第1冊第2版 Unit7-12答案何兆熊 顧大僖 上海外語教育出版社

Ⅰ. 1.kitchen 2. bathroom 3. landed 4. took 5. imagine 6. meaning 7. following 8. experience 9. shouted 10. accident
Ⅱ. 11. kidding 12. will happen 13. were, doing 14. is cleaning 15. sleeps, got 16. was shopping 17. doesn』t think 18. imagine 19. landed 20. surprise
Ⅲ. 21. While 22. While 23. when 24. When 25. while
Ⅳ. 26. B 27 .D 28. A 29. C 30. A 31. C 32. D
33 . A 34. C 35. A 36. B 37. B 38. B 39. A 40. C
Ⅴ. 41. While Mary was shopping, the alien entered the supermarket.
42. The alien was looking at the souvenirs when the shop assistant called the police.
43. The girl was so frightened that she couldn』t move when seeing the wolf.
44. She was surprised to see the UFO in the daytime.
45. looked on 46. happened to Tom 47. Why not give 48. What were, doing 49. didn』t find, anywhere 50. Where was
Ⅵ. 51. started 52. worked 53. so 54. still 55. talk
56. driver 57. easy 58. help 59. after 60. sleep
Ⅶ. A 61. B 62 .C 63 .A 64 .C 65. D
B 66. UFOs 67. No, it isn』t. 68. One large and six smaller objects.
69. No, it wasn』t .

I. c++程序設計基礎教程課後答案(清華大學出版社鄭莉 董淵著)

第 一 章 概述

1-1 簡述計算機程序設計語言的發展歷程。

解:
迄今為止計算機程序設計語言的發展經歷了機器語言、匯編語言、高級語言等階段,C++語言是一種面向對象的編程語言,也屬於高級語言。

1-2 面向對象的編程語言有哪些特點?

解:
面向對象的編程語言與以往各種編程語言有根本的不同,它設計的出發點就是為了能更直接的描述客觀世界中存在的事物以及它們之間的關系。面向對象的編程語言將客觀事物看作具有屬性和行為的對象,通過抽象找出同一類對象的共同屬性(靜態特徵)和行為(動態特徵),形成類。通過類的繼承與多態可以很方便地實現代碼重用,大大縮短了軟體開發周期,並使得軟體風格統一。因此,面向對象的編程語言使程序能夠比較直接地反問題域的本來面目,軟體開發人員能夠利用人類認識事物所採用的一般思維方法來進行軟體開發。C++語言是目前應用最廣的面向對象的編程語言。

1-3 什麼是結構化程序設計方法?這種方法有哪些優點和缺點?

解:
結構化程序設計的思路是:自頂向下、逐步求精;其程序結構是按功能劃分為若干個基本模塊;各模塊之間的關系盡可能簡單,在功能上相對獨立;每一模塊內部均是由順序、選擇和循環三種基本結構組成;其模塊化實現的具體方法是使用子程序。結構化程序設計由於採用了模塊分解與功能抽象,自頂向下、分而治之的方法,從而有效地將一個較復雜的程序系統設計任務分解成許多易於控制和處理的子任務,便於開發和維護。
雖然結構化程序設計方法具有很多的優點,但它仍是一種面向過程的程序設計方法,它把數據和處理數據的過程分離為相互獨立的實體。當數據結構改變時,所有相關的處理過程都要進行相應的修改,每一種相對於老問題的新方法都要帶來額外的開銷,程序的可重用性差。
由於圖形用戶界面的應用,程序運行由順序運行演變為事件驅動,使得軟體使用起來越來越方便,但開發起來卻越來越困難,對這種軟體的功能很難用過程來描述和實現,使用面向過程的方法來開發和維護都將非常困難。

1-4 什麼是對象?什麼是面向對象方法?這種方法有哪些特點?

解:
從一般意義上講,對象是現實世界中一個實際存在的事物,它可以是有形的,也可以是無形的。對象是構成世界的一個獨立單位,它具有自己的靜態特徵和動態特徵。面向對象方法中的對象,是系統中用來描述客觀事物的一個實體,它是用來構成系統的一個基本單位,由一組屬性和一組行為構成。
面向對象的方法將數據及對數據的操作方法放在一起,作為一個相互依存、不可分離的整體--對象。對同類型對象抽象出其共性,形成類。類中的大多數數據,只能用本類的方法進行處理。類通過一個簡單的外部介面,與外界發生關系,對象與對象之間通過消息進行通訊。這樣,程序模塊間的關系更為簡單,程序模塊的獨立性、數據的安全性就有了良好的保障。通過實現繼承與多態性,還可以大大提高程序的可重用性,使得軟體的開發和維護都更為方便。
面向對象方法所強調的基本原則,就是直接面對客觀存在的事物來進行軟體開發,將人們在日常生活中習慣的思維方式和表達方式應用在軟體開發中,使軟體開發從過分專業化的方法、規則和技巧中回到客觀世界,回到人們通常的思維。

1-5 什麼叫做封裝?

解:
封裝是面向對象方法的一個重要原則,就是把對象的屬性和服務結合成一個獨立的系統單位,並盡可能隱蔽對象的內部細節。

1-6 面向對象的軟體工程包括哪些主要內容?

解:
面向對象的軟體工程是面向對象方法在軟體工程領域的全面應用,它包括面向對象的分析(OOA)、面向對象的設計(OOD)、面向對象的編程(OOP)、面向對象的測試(OOT)和面向對象的軟體維護(OOSM)等主要內容。

1-7 簡述計算機內部的信息可分為幾類?

解:
計算機內部的信息可以分成控制信息和數據信息二大類;控制信息可分為指令和控制字兩類;數據信息可分為數值信息和非數值信息兩類。

1-8 什麼叫二進制?使用二進制有何優點和缺點?

解:
二進制是基數為2,每位的權是以2 為底的冪的進制,遵循逢二進一原則,基本符號為0和1。採用二進制碼表示信息,有如下幾個優點:1.易於物理實現;2.二進制數運算簡單;3.機器可靠性高;4.通用性強。其缺點是它表示數的容量較小,表示同一個數,二進制較其他進制需要更多的位數。

1-9 請將以下十進制數值轉換為二進制和十六進制補碼:
(1)2 (2)9 (3)93
(4)-32 (5)65535 (6)-1

解:
(1) (2)10 = (10)2 = (2)16
(2) (9)10 = (1001)2 = (9)16
(3) (93)10 = (1011101)2 = (5D)16
(4) (-32)10 = (11100000)2 = (E0)16
(5) (65535)10 = (11111111 11111111)2 = (FFFF)16
(6) (-1)10 = (11111111 11111111)2 = (FFFF)16

1-10 請將以下數值轉換為十進制:
(1)(1010)2 (2)(10001111)2 (3)(01011111 11000011)2
(4)(7F)16 (5)(2D3E)16 (6)(F10E)16

解:
(1)(1010)2 = (10)10
(2)(10001111)2 = (143)10
(3)(01011111 11000011)2 = (24515)10
(4)(7F)16 = (127)10
(5)(2D3E)16 = (11582)10
(6)(F10E)16 = (61710)10

1-11 簡要比較原碼、反碼、補碼等幾種編碼方法。
解:
原碼:將符號位數字化為 0 或 1,數的絕對值與符號一起編碼,即所謂"符號——絕對值表示"的編碼。
正數的反碼和補碼與原碼表示相同。
負數的反碼與原碼有如下關系:
符號位相同(仍用1表示),其餘各位取反(0變1,1變0)。
補碼由該數反碼的最末位加1求得。

第 二 章 C++簡單程序設計

2-1 C++語言有那些主要特點和優點?

解:
C++語言的主要特點表現在兩個方面,一是全面兼容C,二是支持面向對象的方法。C++是一個更好的C,它保持了C的簡潔、高效、接近匯編語言、具有良好的可讀性和可移植性等特點,對C的類型系統進行了改革和擴充,因此C++比C更安全,C++的編譯系統能檢查出更多的類型錯誤。 C++語言最重要的特點是支持面向對象。

2-2 下列標識符哪些是合法的?
Program, -page, _lock, test2, 3in1, @mail, A_B_C_D

解:
Program, _lock, test2, A_B_C_D是合法的標識符,其它的不是。

2-3 例2.1中每條語句的作用是什麼?
#include <iostream.h>
void main(void)
{
cout<<"Hello!\n";
cout<<"Welcome to c++!\n";
}

解:
#include <iostream.h> //指示編譯器將文件iostream.h中的代碼
//嵌入到該程序中該指令所在的地方
void main() //主函數名,void 表示函數沒有返回值
{ //函數體標志
cout<<"Hello!\n"; //輸出字元串Hello!到標准輸出設備(顯示器)上。
cout<<"Welcome to c++!\n"; //輸出字元串Welcome to c++!
}
在屏幕輸出如下:
Hello!
Welcome to c++!

2-4 使用關鍵字const而不是#define語句的好處有哪些?

解:
const定義的常量是有類型的,所以在使用它們時編譯器可以查錯;而且,這些變數在調試時仍然是可見的。

2-5 請寫出C++語句聲明一個常量PI,值為3.1416;再聲明一個浮點型變數a,把PI的值賦給a。

解:
const float PI = 3.1416;
float a = PI;

2-6 在下面的枚舉類型中,Blue的值是多少?
enum COLOR ;

解:
Blue = 102

2-7 注釋有什麼作用?C++中有哪幾種注釋的方法?他們之間有什麼區別?

解:
注釋在程序中的作用是對程序進行註解和說明,以便於閱讀。編譯系統在對源程序進行編譯時不理會注釋部分,因此注釋對於程序的功能實現不起任何作用。而且由於編譯時忽略注釋部分,所以注釋內容不會增加最終產生的可執行程序的大小。適當地使用注釋,能夠提高程序的可讀性。在C++中,有兩種給出注釋的方法:一種是延用C語言方法,使用"/*"和"*/"括起注釋文字。另一種方法是使用"//",從"//"開始,直到它所在行的行尾,所有字元都被作為注釋處理。

2-8 什麼叫做表達式?x = 5 + 7是一個表達式嗎?它的值是多少?

解:
任何一個用於計算值的公式都可稱為表達式。x = 5 + 7是一個表達式,它的值為12。

2-9 下列表達式的值是多少?
1. 201 / 4
2. 201 % 4
3. 201 / 4.0

解:
1. 50
2. 1
3. 50.25

2-10 執行完下列語句後,a、b、c三個變數的值為多少?
a = 30;
b = a++;
c = ++a;

解:
a:32 ; b:30 ; c:32;

2-11 在一個for循環中,可以初始化多個變數嗎?如何實現?

解:
在for循環設置條件的第一個";"前,用,分隔不同的賦值表達式。
例如:
for (x = 0, y = 10; x < 100; x++, y++)

2-12 執行完下列語句後,n的值為多少?
int n;
for (n = 0; n < 100; n++)

熱點內容
四川農業大學申請考核博士 發布:2025-10-20 08:58:11 瀏覽:981
福田雷沃重工本科生待遇怎麼樣 發布:2025-10-20 08:53:49 瀏覽:575
華為要本科生嗎 發布:2025-10-20 08:25:41 瀏覽:550
2008年青島本科生工資 發布:2025-10-20 08:04:24 瀏覽:444
東北大學藝術考研 發布:2025-10-20 07:38:35 瀏覽:299
我的大學生活txt 發布:2025-10-20 07:35:28 瀏覽:25
人民大學外語系考研 發布:2025-10-20 07:31:12 瀏覽:894
上海交通大學考研輔導班 發布:2025-10-20 07:24:54 瀏覽:420
華中農業大學細胞生物學考研群 發布:2025-10-20 07:09:36 瀏覽:558
南京大學2016考研線 發布:2025-10-20 06:43:12 瀏覽:930