![電大形成性考核冊(cè)c++第一次作業(yè)及答案_第1頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/7/4e031a1e-93f3-44bd-8686-f01530a4764d/4e031a1e-93f3-44bd-8686-f01530a4764d1.gif)
![電大形成性考核冊(cè)c++第一次作業(yè)及答案_第2頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/7/4e031a1e-93f3-44bd-8686-f01530a4764d/4e031a1e-93f3-44bd-8686-f01530a4764d2.gif)
![電大形成性考核冊(cè)c++第一次作業(yè)及答案_第3頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/7/4e031a1e-93f3-44bd-8686-f01530a4764d/4e031a1e-93f3-44bd-8686-f01530a4764d3.gif)
![電大形成性考核冊(cè)c++第一次作業(yè)及答案_第4頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/7/4e031a1e-93f3-44bd-8686-f01530a4764d/4e031a1e-93f3-44bd-8686-f01530a4764d4.gif)
![電大形成性考核冊(cè)c++第一次作業(yè)及答案_第5頁(yè)](http://file2.renrendoc.com/fileroot_temp3/2021-7/7/4e031a1e-93f3-44bd-8686-f01530a4764d/4e031a1e-93f3-44bd-8686-f01530a4764d5.gif)
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、專(zhuān)業(yè)好文檔計(jì)算機(jī)應(yīng)用專(zhuān)業(yè)“c+語(yǔ)言程序設(shè)計(jì)”課程作業(yè)第一次作業(yè)一、填空題1c+語(yǔ)言中的每條基本語(yǔ)句以 ; 作為結(jié)束符,每條復(fù)合語(yǔ)句以 作為結(jié)束符。2用于輸出表達(dá)式值的標(biāo)準(zhǔn)輸出流對(duì)象是 cout ,用于從鍵盤(pán)上為變量輸入值的標(biāo)準(zhǔn)入流對(duì)象是 cin 。3當(dāng)不需要函數(shù)返回任何值時(shí),則應(yīng)把該函數(shù)類(lèi)型定義為 void 。4執(zhí)行“cout143+18=143+18endl;”語(yǔ)句后得到的輸出結(jié)果為 143+18=161 。5執(zhí)行“cout“ning”“chen”38endl;”語(yǔ)句后得到的輸出結(jié)果為 ningchen38 。6在每個(gè)c+程序中都必須包含有這樣一個(gè)函數(shù),該函數(shù)的函數(shù)名為 main 。7c+源
2、程序文件的缺省擴(kuò)展名為 cpp ,由c+源程序文件編譯而成的目標(biāo)文件的缺省擴(kuò)展名為 obj ,由c+目標(biāo)文件連接而成的可執(zhí)行文件的缺省擴(kuò)展名為 exe 。8程序運(yùn)行中需要從鍵盤(pán)上輸入多于一個(gè)數(shù)據(jù)時(shí),各數(shù)據(jù)之間應(yīng)使用 空格 或 逗號(hào) 符號(hào)作為分隔符。9十進(jìn)制數(shù)25表示成符號(hào)c+語(yǔ)言規(guī)則的八進(jìn)制和十六進(jìn)制數(shù)分別為 31 和 19 符號(hào)。10在c+語(yǔ)言中,用轉(zhuǎn)義字符序列 n 或操縱符 endl 表示輸出一個(gè)換行符。11執(zhí)行“coutchar(b+2)endl;”語(yǔ)句后得到的輸出結(jié)果為 d 。12執(zhí)行“coutchar(k-3)endl;”語(yǔ)句后得到的輸出結(jié)果為 h 。13已知az的ascii碼為65
3、90,當(dāng)執(zhí)行“int x=h+5;”語(yǔ)句后x的值為 77 。14已知az的ascii碼為6590,當(dāng)執(zhí)行“char ch=16*5+2;coutchendl;語(yǔ)句序列后,得到的輸出結(jié)果為 r 。15假定一個(gè)枚舉類(lèi)型的定義為“enum raxa,xb,xc,xd;”,則執(zhí)行“cout”xc=”xcendl;”語(yǔ)句得到的輸出結(jié)果為 xc=2 。16假定一個(gè)枚舉類(lèi)型的定義為“enum rbab,ac=3,ad,aex=ad;”則x的值為 4 。17char、short和int類(lèi)型的大小分別為 1字節(jié) 、 2字節(jié) 和 4字節(jié) 。18float和double類(lèi)型的大小分別為 4字節(jié) 和 8字節(jié) 。19十
4、進(jìn)制數(shù)128和-3.26的類(lèi)型分別為 整型 和 雙精度型 。20若需要定義一個(gè)標(biāo)識(shí)符常量,并且使c+能夠進(jìn)行類(lèi)型檢查,則應(yīng)在定義語(yǔ)句的開(kāi)始用保留字 define 。21使用const語(yǔ)句定義一個(gè)標(biāo)識(shí)符常量時(shí),則必須對(duì)它同時(shí)進(jìn)行 初始化 。22執(zhí)行“int x=45,y=16;coutx/yx%yz的相反表達(dá)式為 x+y5& x10的相反表達(dá)式 x=10 。34邏輯表達(dá)式ab | | b= =5的相反表達(dá)式為 ay 和x=y的邏輯值分別為 false 和 true 。36假定x=5,則執(zhí)行“a=(x? 10:4*2);”語(yǔ)句后a的值為 10 。37假定a=5,則條件表達(dá)式“a= =0? 10:2
5、0”的值為 20 。38執(zhí)行“typedef int data type;”語(yǔ)句后,在使用int定義整型變量的地方都可以使用 datatype 定義整型變量。39設(shè)x和y均為bool量,x & & y為真的條件是 x=true y=true 。40設(shè)x和y均為bool量,則x | | y為假的條件是 x、y都為false 。二、寫(xiě)出下列程序運(yùn)行后的輸出結(jié)果1#include void sb (char ch) switch (ch) case a :case a: cout ”well”!” ; break; case b: case b: cout ”good!” ;break; case
6、c: case c: cout ”pass!” ;break; default : cout “bad!” ; break;void main () char al=b,a2=c,a3=f; sb(al);sb(a2);sb(a3);sb(a); cout endl;good!pass!bad!well!2、#clude #includedouble sd(int a,int b,char op) double x; switch (op) case x:x=double(a) + b; break; case -: x=double (a) b; break; case * x=double
7、 (a) * b;break; case /:if (b) x=double (a)/b; else exit(1); break; default:exit(1); return x; void main ()int x=20 ,y=12;cout sd(x,y,-) ;cout sd(x,y,*) ;cout sd(x+y,y-2,/)endl;8 240 3.23、#include void main () int s=0; for (int i=1;i6;i+) s+=i*i; cout ”s=”sendl;s=554、# include void main () int s=0; f
8、or (int i=1;i+) if (s50) break; if (i%3= =0) s+=i; cout ”i,s=”i”,”sendl;i,s=19,635、# include void main ()int s1=0,s2=0;for (int i=0;i10;i+) if (i%2) s1+=i; else s2 +=i;cout s1 s2endl;25 206、# include void main ()int n=10,y=1;while (n-)y+;+y;cout ”y*y=”y*yendl;y*y=441三、寫(xiě)出下列每個(gè)函數(shù)的功能1include int sa(int
9、a,int b) if(ab) return 1; else if(a= =b) return 0; else return 1;比較兩個(gè)整數(shù)a和b,如果a大于b則返回1;如果a等于b則返回0;如果a小于b則返回-1。2int sc(int a,int b,int c) if(a=b & a=c) return a;if(b=a & b=c) return b;if(c=a & c=b) return c;返回a、b、c三個(gè)數(shù)中的最大數(shù)。3int se(int n) / /n為大于等于1的整數(shù)int x;cinx;if(n= =1) return x;int m=x;while(n) cinx
10、; m+=x;return m;求輸入的n個(gè)數(shù)之和。4double sf (double x,int n) / /n為大于等于0的整數(shù) double p=1,s=1; for(int i=1;i=n;i+ +) p* =x;s+ =p/(i+1); return s; 計(jì)算1+x/2+x2/3+x3/4+xn/(n+1)5includebool sg(int x) / /x為大于等于2的整數(shù) int a=int(sqrt(x);/ /取x的平方根 int i=2; while(i=a) if(x%i= =0) break; i+ +; if(ix; while(x!= 100) n+ +;y+
11、=x; cinx; if(n= =0) return y;else return y/n; 求鍵盤(pán)輸入的數(shù)的平均值,輸入-100結(jié)束(不計(jì)在平均值內(nèi)),若沒(méi)有數(shù)輸入則返回0。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 wante
12、d to meet ivory coast international toure to discuss his complaint.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. yo
13、u can always find money from somebody to pay them.it is a nonsense 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 hav
14、e today in our game. but it is only with harsh sanctions that 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 wi
15、ll attend citys premier league match at chelsea on sunday.i 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 agai
16、nst cskafor the racist behaviour of their fans duringcitys 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
17、 added: we found no racist insults from fans of cska.baumgartner 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
18、 precipitation or humidity and limited cloud cover. the balloon, 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
19、the cruising altitude of commercial airliners (5.6 miles/9.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 ste
20、p out onto something resembling an olympic diving platform.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
21、 diving into the shallow end.skydiver preps for the big jumpwhen 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
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030年中國(guó)電動(dòng)工具零配件數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)漁用乙綸網(wǎng)線(xiàn)數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)衛(wèi)生臺(tái)板數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025年中國(guó)平板電視鋁配件市場(chǎng)調(diào)查研究報(bào)告
- 2025至2031年中國(guó)液壓分塊機(jī)行業(yè)投資前景及策略咨詢(xún)研究報(bào)告
- 2025至2031年中國(guó)三輪摩托車(chē)發(fā)電機(jī)行業(yè)投資前景及策略咨詢(xún)研究報(bào)告
- 2025至2030年中國(guó)電子健康稱(chēng)數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)深度游標(biāo)卡尺數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025至2030年中國(guó)恒壓供水實(shí)驗(yàn)裝置數(shù)據(jù)監(jiān)測(cè)研究報(bào)告
- 2025年中國(guó)輪胎拆裝機(jī)市場(chǎng)調(diào)查研究報(bào)告
- 5《這些事我來(lái)做》(說(shuō)課稿)-部編版道德與法治四年級(jí)上冊(cè)
- 2025年度高端商務(wù)車(chē)輛聘用司機(jī)勞動(dòng)合同模板(專(zhuān)業(yè)版)4篇
- 2025年福建福州市倉(cāng)山區(qū)國(guó)有投資發(fā)展集團(tuán)有限公司招聘筆試參考題庫(kù)附帶答案詳解
- 2025年人教版新教材數(shù)學(xué)一年級(jí)下冊(cè)教學(xué)計(jì)劃(含進(jìn)度表)
- GB/T 45107-2024表土剝離及其再利用技術(shù)要求
- 2025長(zhǎng)江航道工程局招聘101人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- 2025年黑龍江哈爾濱市面向社會(huì)招聘社區(qū)工作者1598人歷年高頻重點(diǎn)提升(共500題)附帶答案詳解
- 五年級(jí)上冊(cè)脫式計(jì)算100題及答案
- 縣道及以上公路保潔考核檢查評(píng)分表
- 警燈、警報(bào)器使用證申請(qǐng)表
- 中國(guó)科學(xué)院率先行動(dòng)計(jì)劃組織實(shí)施方案
評(píng)論
0/150
提交評(píng)論