【正文】
k。 for (int I=1。 int i0=0,i1=0,i2=0。 for(int i=0。b2endl。a39。 } i++。i++) coutc[i]39。 39。 for(int i=0。 do{ cout *p 39。 39。 a = b。 m){ // 按地址傳遞 a = new int[m]。 a++。 delete[]d。} 運(yùn)行結(jié)果: weirong 55 640 weirong 60 630 25. include include struct Worker{ char name[15]。 couta? ?bendl。} }。 class B:public A{ int b。b = bb。%39。 (13,8, 39。 = a 。 void main(){ FF int x(8,3,4),y(5,9,11)。 for(i = n 1。in。 istr x. name x.. age x.. pay。} 函數(shù)功能:建立一有 n 個(gè)結(jié)點(diǎn)的、頭指針為 f 的、數(shù)據(jù)類型為 StrNode 結(jié)構(gòu)類型的鏈表。 int i = 0。 4. include include void JD(char * fname) / /可把以 fname 所指字符串作為文件標(biāo)識(shí)符的文件稱為 fname 文件 , / /假定該文件保存著一批整數(shù)。b++) 9 if(2*a+5*b==126) cout39?!?,要求把數(shù)組 a中的 n個(gè)元素值按相反的次序仍保存在數(shù)組 a中。 violence, and lack of suitability for children39。} 請(qǐng)您刪除一下內(nèi)容, O(∩ _∩ )O 謝謝?。。 ?China39。 i) { couta[i]? ?。 for(a=6。 ((char * )amp。}} 函數(shù)功能 : 建立磁盤文件(文件名由參數(shù) fname給定),鍵盤輸入一批字符串(每個(gè)字符串長度小于 20),存入此文件中,當(dāng)輸入 ”end”時(shí)結(jié)束輸入。 StrNode * p = f。 istream amp。i + +) s + = a[i]。 7. include void LI(int n){ int * a = new int[n], * p = a + n。a2 =b2。 = b + 。 (4,9, 39。/39。 void main(){ B x(5),y(6,7)。 delete p。 A * p = new A(5)。} 運(yùn)行結(jié)果: liouting 46 725 26. include class A{ int a,b。39。i5。} 運(yùn)行結(jié)果: 1 3 5 7 9 23. include void LH(int * a, int n){ int * p = a + n1。 LF(x,y)。 c 39。y。i++) coutsetw(5) *p。 39。jj=j。 while(a[i]=b[j]) j++。d39。i2endl。i++) if(a[i]b1){ if(b1b2)b2=b1。i2endl。++y。I6。 break。當(dāng)需要使用 istream 流類定 義一個(gè)流對(duì)象并聯(lián)系一個(gè)字符串時(shí),應(yīng)在文件開始使用 include 命令,使之包含 文件。 AB 為一個(gè)類,則該類的拷貝構(gòu)造函數(shù)的聲明語句為 AB (AB amp。 ,對(duì)基類成員、類對(duì)象成員和非類對(duì)象成員的初始化次序的先 基類成員 ,后 類對(duì)象成員 ,最后 非類對(duì)象成員 ?!?,則該類型的大小為 36 字節(jié)。 54.假定 a是一個(gè)一維數(shù)組,則 a[i]的指針訪問方式為 * ( a+ i ) 。 40.設(shè) x和 y均為 bool 量,則 x | | y為假的條件是 x和 y均為 false。 30.關(guān)系表達(dá)式( x= =0)的等價(jià)表達(dá)式為 !( x! =0) 。 17. Char、 short 和 int 類型的大小分別為 1B 、 2B 和 4B 。 作為結(jié)束符,每條復(fù)合語句以 } 作為結(jié)束符。 for(int i=0。 A. 0 B. ?0? C. ”0” D. ?\n? 33. 在下面的一維數(shù)組定義中,有語法錯(cuò)誤的是( C)。 A. void B. int C. new D. long 28. 下面的函數(shù)聲明中, (B)是 “void BC(int a, int b)。 A. 1 B. n C. n1 D. n+1 21. 由 C++源程序文件編譯而成的目標(biāo)文件的缺省擴(kuò)展名為( A)。 in。 8. 若用數(shù)組名作為函數(shù)調(diào)用的實(shí)參,傳遞給形參的是( A)。 A. main B. MAIN C. name D. function 2.設(shè) x和 y均為 bool 量,則 x amp。 B. char a[]=”x+y=55.”。 15. 假定 a 為一個(gè)整型數(shù)組名,則元素 a[4]與( C)的表示等價(jià)。 D. BOOK x=new BOOK。 C. int a[]。)。 A. 逗號(hào) B. 分號(hào) C. 空格 D. 換行符 36. 含隨機(jī)函數(shù)的表達(dá)式 rand()%20 的值在 (C)區(qū)間內(nèi)。p=*m。 14.已知 ?A?~?Z?的 ASCII 碼為 65~90,當(dāng)執(zhí)行 “char ch=16*5+2; coutchendl;語句序列后,得到的輸出結(jié)果為 R 。 。 39.設(shè) x和 y均為 bool量, x amp。 表達(dá)式值為: 25 52.假定 p所指對(duì)象的值為 25, p+1 所指對(duì)象的值為 50,則執(zhí)行 “*(p+ +)。 63.假定一個(gè)結(jié)構(gòu)類型的定義為 “struct B{ int a[8]。 析構(gòu)函數(shù) 。 AB 中有一個(gè)靜態(tài) 整型成員 bb,在類外的它進(jìn)行定義并初始化為 0時(shí),所使用寫法為: int AB:: bb = 0 ; 。 程序 文件中進(jìn)行文件輸入輸出操作,則必須在開始的 include 命令中使用 頭文件。 Cout endl。 cout SD(x+y,y2,?/?)endl。 // s2= 0+2+4+6+8 cout s1? ?s2endl。 39。 b1=b2=a[0]。 i ++。 : b[2]++。 for(int i=0。j4。 39。 coutendl。 39。 int c =LA(a+3,2)。 // y = 13 + 8 = 21 cout”x =” x ”,y =” y endl。 i++) cout p[i] ? ?。} coutendl。x。 x. age = d。 cout”Constructor! ” * aendl。}}。 public: B(int aa= 0, int bb= 0): A(aa){b = bb。*39。*39。} B operator +(Bamp。()。 3. int SE(int n) { / /n為大于等于 1 的整數(shù) int x; cinx; if(n= =1) return x; int m=x; while(――n){ cinx; m+=x;} return m; } 函數(shù)功能:計(jì)算并返回鍵盤輸入的 n個(gè)整數(shù)的和。int i。/ /姓名 / / int age。return。 cin a。 for(int i = 0。 五、按題目要求編寫程序 1. 已知 6≤a≤ 15≤b≤36,求出滿足不定方程 2a+5b=126的全部整數(shù)組解。 void Print(int a[], int n) { int i,j=0。 else return a[n1]*FF(a,n1)。t want to steal food like other mice. Shuke became a pilot and Beita became a tank driver, and the pair met accidentally and became good friends. Then they befriended a boy named Pipilu. With the help of PiPilu, they cofounded an airline named Shuke Beita Airlines to help other animals. Although there are only 13 episodes in this series, the content is very pact and attractive. The animation shows the preciousness of friendship and how people should be brave when facing difficulties. Even adults recalling this animation today can still feel touched by some scenes. Secrets of the Heavenly Book Secrets of the Heavenly Book, (Chinese: 天書奇談 ) also referred to as Legend of the Sealed Book or Tales about the Heavenly Book, was released in 1983. The film was produced with rigorous dubbing and fluid bination of music and vivid animations. The story is based on the classic literature Ping Yao Zhuan, meaning The Suppression of the Demons by Feng Menglong. Yuangong, the deacon, opened the shrine and exposed the holy book to the human world. He carved the book39。 i++) { int x=a[i]。,39。 whlie(((char * )amp。} ()。}。其功能為:輸入一具有Worker類型的結(jié)構(gòu)變量的 name、 age、 pag各成員的值,并通過引用形參 x 返回。 int * p = b。 cout ?\ n?。amp。} void OutB(){ cout a ? ? b endl。 a += x. Comp()。 default:exit(1)。+39。 void main(){ B x(2,3),y(4,5)。 delete p。} 運(yùn)行結(jié)果: 6 3 8 10 27. include class A{ int a, b。 //工資 }。 //年齡 float pay。 int i。im。} void main(){ int x =15,y =36。 for(int i =0。 }while(pa+8)。 if((i +1)%4 ==0)coutendl。 cout a 39。} 運(yùn)行結(jié)果: 2 1 6 1 13. include void main(){ int a[3][4] = {{1,2,7,8},{5,6,11,12},{24,10,3,4}}。i++)coutb[i]39。 case 39。 while(a[i]){ if(a[i] = = 39。//p1:最大; p2:最小 if(strcmp(a[i],p2)0) p2=a[i]。i++) switch(b=a[i]%3) { case 0: i0++。 // s=3+6+9+12+15+18 } cout ”I,s=”I”,”sendl。