線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1270
推到 Plurk!
推到 Facebook!

如何定義一個集合

答題得分者是:Justmade
soulin12
一般會員


發表:22
回覆:21
積分:8
註冊:2003-05-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-27 18:36:37 IP:61.145.xxx.xxx 未訂閱
想定義一個字符串類型的集合,它的值是任意無序的,我是這樣寫的: type MyString = Set of string ; 編譯就出錯如下內容: Ordinal type required 應該怎樣寫呢?
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-27 19:22:31 IP:61.10.xxx.xxx 未訂閱
Set 只可以對應 ordinal type 的 from Delphi Help : Ordinal types include integer, character, Boolean, enumerated, and subrange types. An ordinal type defines an ordered set of values in which each value except the first has a unique predecessor and each value except the last has a unique successor. Further, each value has an ordinality, which determines the ordering of the type. For integer types, the ordinality of a value is the value itself; for all other ordinal types except subranges, the first value has ordinality 0, the next value has ordinality 1, and so forth. If a value has ordinality n, its predecessor has ordinality n – 1 and its successor has ordinality n 1. 你可看 delphi help 中有關 ordinal type 的說明取得更多的資料 若你要處理一堆字串,試試使用 Array of String 罷。
soulin12
一般會員


發表:22
回覆:21
積分:8
註冊:2003-05-07

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-27 20:41:43 IP:61.145.xxx.xxx 未訂閱
非常謝謝 Justmade 給了我詳細的解答,我要的就是一種思想, 剛從VFP轉向Delphi,好多簡單的問題都處理不了,希望我也有一天能像你一樣給別人解決問題,那將是一件非常自豪的事,謝了
系統時間:2024-07-08 7:55:22
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!