【正文】
iginal series was announced. Critics bemoan the series39。 month=mth。 Date(dateamp。 date d3(d1)。所有數(shù)據(jù)成員都定義為私有成員。//用已有日期 x構(gòu)造一個(gè)新對象 (1999,3,13)。 } A:include B: int sumofarray=0。 b 。 // 4 Stack *q5 = new Stack。 問題 4:程序中模板類 Stack 的析構(gòu)函數(shù)主要做了什么事情?為什么要這么做? 答: 析構(gòu)函數(shù)中主要是釋放存放的各個(gè)節(jié)點(diǎn)所 占涌空間。 ( C) ptop = top。 51. if (bottom == NULL) bottom = top = pNew。 //返回值 39. ______(C) ________。)。 6. /***************** 定義模板類 StackItem ******************/ 7. templateCLASS TYPE 8. class StackItem 9. { 10. public: 11. StackItem(const Type amp。 i++) { if (charAry [i] mixCode) mixCode = str[i]。//若非末尾,則有下一節(jié)點(diǎn) prenext = newNode。 Pre = head; if (head == NULL) head = newNode。 函數(shù)參數(shù):函數(shù)的第一個(gè)參數(shù) head 指向鏈表頭一節(jié)點(diǎn)的指針,如果鏈表為 空,則 head 的值為 NULL。 函數(shù)返回值:相應(yīng)于給定的 n,右邊表達(dá)式運(yùn)算結(jié)果。 amp。 ( 40分) 1.寫一個(gè)函數(shù),找出給定字符串中大寫字母字符(即’ A’ ‘ Z’這 26個(gè)字母)的個(gè)數(shù)(如字符串” China Computer Wrold”中大寫字母字符的個(gè)數(shù)為 3 個(gè))。 //判斷字符指針是否為空 int num_of_Capital = 0。Z39。 } 3. 給定新數(shù)值,在一個(gè)按節(jié)點(diǎn)所存放數(shù)值從大到小排序的鏈表中,找適當(dāng)位置插一個(gè)新節(jié)點(diǎn),仍保持有序的鏈表,寫一個(gè)函數(shù),完成此操作。 答: Node * insNode(Node * head, int newValue) { Node * newNode = new Node。 //插入到鏈表的表頭 } else{ //在鏈 表尋找插入點(diǎn) Node *cur,*pre = head。 函數(shù)的原型: char MinCode(char charAry[])。在這個(gè)文件中,首先定義了一個(gè)堆棧元素類模板 StackItem,然后,在這個(gè)類的基礎(chǔ)上定義了堆棧類模板 Stack。 16. friend class Stack。 30. StackItem * bottom。 42. delete ptop。 59. while(p != NULL) { 60. q = pnextItem。 問題 2:程序第 4, 5 行有什么作用?如果沒有這兩行語句,程序還正確嗎? 答: 不正確。 問題 5:下面的程序使用了 文件中定義的類模板,請說明下列程序中定義堆棧對象的語句 (15)是否正確。主程序中定義了并初始化了一個(gè)數(shù)組,然后計(jì)算該數(shù)組各元素的和,并輸出結(jié)果。 } int sum(int array[],int len) { int isum = 0。//取月份 int getday ()。 cout date:。 修改程序,在日期類中定義日期的輸出函數(shù),這樣,主程序就可以簡化。 ()。} int GetMonth(){return month?!?} void Date::Print(){cout”Date”。s real name was Nasreddin. He was wise and witty and, more importantly, he had the courage to resist the exploitation of noblemen. He was also full of passion and tried his best to help poor people. Adventure of Shuke and Beita【舒克與貝塔】 Adventure of Shuke and Beita (Chinese: 舒克和貝塔 ) is a classic animation by Zheng Yuanjie, who is known as King of Fairy Tales in China. Shuke and Beita are two mice who don39。s Film Festival Award in 1989. McDull【麥兜】 McDull is a cartoon pig character that was created in Hong Kong by Alice Mak and Brian Tse. Although McDull made his first appearances as a supporting character in the McMug ics, McDull has since bee a central character in his own right, attracting a huge following in Hong Kong. The first McDull movie McMug Story My Life as McDull documented his life and the relationship between him and his McMug Story My Life as McDull is also being translated into French and shown in France. In this version, Mak Bing is the mother of McDull, not his father..