American Gladiator,You are consulting for a game show in which n contestants are pitted against n gladiators in order to see which contestants are the best. The game show aims to rank the contestants in order of strength this is done via a series of 1-on-1 matches between contestants and gladiators. If the contestant is stronger than the gladiator, then the contestant wins the match otherwise, the gladiator wins the match. If the contestant and gladiator have equal strength, then they are “perfect equals” and a tie is declared. We assume that each contestant is the perfect equal of exactly one gladiator, and each gladiator is the perfect equal of exactly one contestant. However, as the gladiators sometimes change from one show to another, we do not know the ordering of strength among the gladiators.
Preparation of a function, even to the importation of n, the function call seeking +1/n 1/2+1/4+ .... When n is odd input, the function call 1/1+1/3+ ... +1/n (using function pointer)
Embest S3C44B0X Evaluation Board
RTC Test Example
RTC Check(Y/N)? y
Set Default Time at 2004-12-31 FRI 23:59:59
Set Alarm Time at 2005-01-01 00:00:01
... RTC Alarm Interrupt O.K. ...
Current Time is 2005-01-01 SAT
00:00:01
RTC Working now. To set date(Y/N)? y
Current date is (2005,01,01, SAT). input new date (yy-mm-dd w): 5-2-23 3
Current date is: 2005-02-23 WED
RTC Working now. To set time(Y/N)? y
Current time is (00:00:21). To set time(hh:mm:ss): 19:32:5
Current Time is 2005-02-23 WED
19:32:
假定已經有許多應用采用了程序1 - 1 5中所定義的C u r r e n c y類,現在我們想要對C u r r e n c y類
的描述進行修改,使其應用頻率最高的兩個函數A d d和I n c r e m e n t可以運行得更快,從而提高應
用程序的執行速度。由于用戶僅能通過p u b l i c部分所提供的接口與C u r r e n c y類進行交互,
鄰接矩陣類的根是A d j a c e n c y W D i g r a p h,因此從這個類開始。程序1 2 - 1給出了類的描述。程
序中,先用程序1 - 1 3中函數Make2DArray 為二組數組a 分配空間,然后對數組a 初始化,以描述
一個n 頂點、沒有邊的圖的鄰接矩陣,其復雜性為( n2 )。該代碼沒有捕獲可能由M a k e 2 D A r r a y
引發的異常。在析構函數中調用了程序1 - 1 4中的二維數組釋放函數D e l e t e 2 D