電大《C++語(yǔ)言程序設(shè)計(jì)》第一次作業(yè)_第1頁(yè)
電大《C++語(yǔ)言程序設(shè)計(jì)》第一次作業(yè)_第2頁(yè)
電大《C++語(yǔ)言程序設(shè)計(jì)》第一次作業(yè)_第3頁(yè)
電大《C++語(yǔ)言程序設(shè)計(jì)》第一次作業(yè)_第4頁(yè)
電大《C++語(yǔ)言程序設(shè)計(jì)》第一次作業(yè)_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、專業(yè)好文檔2009年寧波電大c+語(yǔ)言程序設(shè)計(jì)第一次作業(yè)一、填空題。 1一個(gè)基本語(yǔ)句的最后一個(gè)字符是 。 2函數(shù)調(diào)用時(shí),實(shí)參向形參的傳送分為 和 兩種傳送方式。 3若應(yīng)用程序onefunc.cpp中只有一個(gè)函數(shù),這個(gè)函數(shù)的名稱是 。 4變量分為全局和局部?jī)煞N, 變量沒有賦初值時(shí),其值是不確定的。 5常量345l占用 字節(jié)存儲(chǔ)空間。 6執(zhí)行int i,s; for(i=8,s=0;i0;i-) s+=i; while(+i5) s+=i; 后; s的值是 。 7執(zhí)行for(int i=0;i=20;i+) cout100?100:0的值賦值給變量y的賦值語(yǔ)句是 。10字符串”字符串”占用 字節(jié)的空

2、間。11”firstlinen2ndline”的長(zhǎng)度是 。12執(zhí)行int a=5,b; b=a+;后,a的值為 ,b的值為 。13假定x=10,y=6,則表達(dá)式2+x+和+y*3的值分別為 和 。14執(zhí)行coutc+15;,顯示在屏幕上的是 。15假定一個(gè)枚舉類型的定義為“enum rbab,ac=3,ad,aex=ad;”,則x的值為 。16執(zhí)行“cout143+17=143+17endl;”語(yǔ)句后得到的輸出結(jié)果為 。17利用操作符+,語(yǔ)句序列p=p+1;f=p+15;的功能可以由一個(gè)語(yǔ)句完成,這個(gè)語(yǔ)句是 。18x+yb&ab的值相同 d、與a=b的值相同 2c+字符串“abc”以 符號(hào)作為

3、結(jié)束符,需 字節(jié)的 存儲(chǔ)空間。( )。 a、 c,3 b、 c,4 c、0,3 d、0,4 3從定義unsigned var;可以看出,var是一個(gè)( )變量。 a、無符號(hào)短整型 b、無符號(hào)小整型 c、無符號(hào)整數(shù) d、無符號(hào)長(zhǎng)整型 4以下合法的c+字符常量是( )。 a、b b、 a c、 65 d、 a 5執(zhí)行int k,d=8; k=d+*3;后,k和d的值分別為( )。 a、24 8 b、24 9 c、27 8 d、27 9 6以下程序的輸出結(jié)果是( )。 a、11 b、10 c、9 d、10 11 for(j=10;j11;j+) for(i=9;i=j-1) coutj; 7下列的常

4、值變量定義中,錯(cuò)誤的是( )。 a、const int ll=210; b、const char ch=67 c、const double d; d、const long ld=345; 8以下程序的輸出結(jié)果是( )。 a、 c b、 d c、 e d、 f char ch; ch=c+5-3; cout0)|(e0) c、(e=0) d、(e!=0)三、程序改錯(cuò)題。不得增加語(yǔ)句、刪除語(yǔ)句,只能在原句改正。1輸入3個(gè)數(shù),找出其中最大一個(gè)并顯示出來。#include void main() int a,j,k,m;cout”請(qǐng)輸入3個(gè)整數(shù):”;cinajk;cout”3個(gè)數(shù)中的最大的是:”;if

5、(aj) j=a;if(ak) a=k;coutaendl;2輸入10個(gè)數(shù),計(jì)算并顯示它們的合計(jì)。#include void main()double x,s;cout”請(qǐng)輸入10個(gè)數(shù):”;for(int j=0;jx; s=x;cout”合計(jì):”s;四、編程序題。1設(shè)計(jì)一個(gè)程序,輸入4個(gè)數(shù),找出其中最小一個(gè)并顯示出來。2輸入10個(gè)整數(shù)到一個(gè)數(shù)組中,調(diào)整這10個(gè)數(shù)在數(shù)組中的排列位置,使得其中最小的一個(gè)數(shù)成為數(shù)組的首元素,并輸出處理后的數(shù)據(jù)。五、寫出下列程序運(yùn)行后的輸出結(jié)果。1#include void main() int s=0; for(int i=1;i6;i+) s+=i*i; cou

6、t”s=”sendl;2#include void main() int n=10,y=1; while(n-) y+;+y; cout”y*y=”y*yendl;3#include void sb(char ch) switch(ch)case a: case a: cout”well!”;break; case b: case b: cout”good!”;break; case c: case c: cout”pass!”;break; default: cout”bad!”;break;void main() char a1=b,a2=c,a3=f; sb(a1);sb(a2);sb(

7、a3);sb(a); cout100?100:0; 10. 7 11. 17 12. 6 5 13. 12 21 14. 8215. 4 16. 143+17=160 17. f=+p+15; 18. x+y=319. a*a*a+3*a*a*a*b+3*a*b*b+b*b*b 20. 類型修飾符 形式參數(shù)表二、選擇題。1.b 2.d 3.c 4.a 5.b 6.b 7.c 8.c 9.a 10.c三、程序改錯(cuò)題。不得增加語(yǔ)句、刪除語(yǔ)句,只能在原句改正。1、cinajajk; j=a; 改正為:a=j;2、double x,s; 改正為:double x,s=0; s=x; 改正為:s+=x;

8、四、編程題。1. #include void main() double a,b,c,d; coutabcd; if(ab) a=b; if(ac) a=c; if(ad) a=d; cout”最大數(shù)是:”a;2. #include void main() int data10,m,j=0; cout”請(qǐng)輸入10個(gè)整數(shù):”; for(m=0;mdatam; for(m=1;m10;m+) if(datam0) m=data0;data0=dataj;dataj=m; coutendl; for(m=0;m10;m+) coutdatam ;五、寫出下列程序的運(yùn)行結(jié)果。1. s=55 2. y*

9、y=441 3. good!pass!bad!well!if we dont do that it will go on and go on. we have to stop it; we need the courage to do it.his comments came hours after fifa vice-president jeffrey webb - also in london for the fas celebrations - said he wanted to meet ivory coast international toure to discuss his co

10、mplaint.cska general director roman babaev says the matter has been exaggerated by the ivorian and the british media.blatter, 77, said: it has been decided by the fifa congress that it is a nonsense for racism to be dealt with with fines. you can always find money from somebody to pay them.it is a n

11、onsense to have matches played without spectators because it is against the spirit of football and against the visiting team. it is all nonsense.we can do something better to fight racism and discrimination.this is one of the villains we have today in our game. but it is only with harsh sanctions th

12、at racism and discrimination can be washed out of football.the (lack of) air up there watch mcayman islands-based webb, the head of fifas anti-racism taskforce, is in london for the football associations 150th anniversary celebrations and will attend citys premier league match at chelsea on sunday.i

13、 am going to be at the match tomorrow and i have asked to meet yaya toure, he told bbc sport.for me its about how he felt and i would like to speak to him first to find out what his experience was.uefa hasopened disciplinary proceedings against cskafor the racist behaviour of their fans duringcitys

14、2-1 win.michel platini, president of european footballs governing body, has also ordered an immediate investigation into the referees actions.cska said they were surprised and disappointed by toures complaint. in a statement the russian side added: we found no racist insults from fans of cska.baumga

15、rtner the disappointing news: mission aborted.the supersonic descent could happen as early as sunda.the weather plays an important role in this mission. starting at the ground, conditions have to be very calm - winds less than 2 mph, with no precipitation or humidity and limited cloud cover. the bal

16、loon, with capsule attached, will move through the lower level of the atmosphere (the troposphere) where our day-to-day weather lives. it will climb higher than the tip of mount everest (5.5 miles/8.85 kilometers), drifting even higher than the cruising altitude of commercial airliners (5.6 miles/9.

17、17 kilometers) and into the stratosphere. as he crosses the boundary layer (called the tropopause),e can expect a lot of turbulence.the balloon will slowly drift to the edge of space at 120,000 feet ( then, i would assume, he will slowly step out onto something resembling an olympic diving platform.

18、below, the earth becomes the concrete bottom of a swimming pool that he wants to land on, but not too hard. still, hell be traveling fast, so despite the distance, it will not be like diving into the deep end of a pool. it will be like he is diving into the shallow end.skydiver preps for the big jum

19、pwhen he jumps, he is expected to reach the speed of sound - 690 mph (1,110 kph) - in less than 40 seconds. like hitting the top of the water, he will begin to slow as he approaches the more dense air closer to earth. but this will not be enough to stop him completely.if he goes too fast or spins out of control, he ha

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝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ù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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)論