數組存儲 |
答題得分者是:Stallion
|
joon
一般會員 發表:35 回覆:41 積分:14 註冊:2004-01-02 發送簡訊給我 |
|
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
//---------------------------------------------------------------------------
#include #pragma hdrstop #include "Unit1.h" #include "StrUtils.hpp" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { String TempValue, HexValue = "000042822880492CA00044D60FA048B6E200"; int Count, Step = 8; TStringList *aList; this->Memo1->Lines->Clear(); try { aList = new TStringList; while ( ( TempValue = LeftStr(HexValue,Step) ).Length() > 0 ) { aList->Add(TempValue); HexValue = RightStr(HexValue,HexValue.Length()-Step); } for ( Count = 0 ; Count < aList->Count ; Count ) this->Memo1->Lines->Add(aList->Strings[Count]); } __finally { delete aList; } } //--------------------------------------------------------------------------- |
pcboy
版主 發表:177 回覆:1838 積分:1463 註冊:2004-01-13 發送簡訊給我 |
最快, 行內組合語言
t[i]最大能保存多少 ? 看您的宣告方式吧, 極限應該是吃盡系統資源 (例如 RAM 用光 or HD 爆滿) i 值請參考 Help Static array types are denoted by constructions of the form array[indexType1, ..., indexTypen] of baseType where each indexType is an ordinal type whose range does not exceed 2GB. Since the indexTypes index the array, the number of elements an array can hold is limited by the product of the sizes of the indexTypes. In practice, indexTypes are usually integer subranges. -------- Dynamic arrays do not have a fixed size or length. Instead, memory for a dynamic array is reallocated when you assign a value to the array or pass it to the SetLength procedure. Dynamic-array types are denoted by constructions of the form -------- procedure SetLength(var S; NewLength: Integer); Description S is a Delphi string or dynamic-array variable. NewLength is the new number of characters or elements in S. For a short-string variable, SetLength simply sets the length-indicator character (the character at S[0]) to the given value. In this case, NewLength must be a value between 0 and 255. For a long-string or dynamic-array variable, SetLength reallocates the string or array referenced by S to the given length. Existing characters in the string or elements in the array are preserved, but the content of newly allocated space is undefined. The one exception is when increasing the length of a dynamic array in which the elements are types that must be initialized (strings, Variants, Variant arrays, or records that contain such types). When S is a dynamic array of types that must be initialized, newly allocated space is set to 0 or nil. For dynamic arrays, SetLength may take more than one length parameter (up to the number of array dimensions). Each parameter specifies the number of elements along a particular dimension. Following a call to SetLength, S is guaranteed to reference a unique string or arrayhat is, a string or array with a reference count of one. If there is not enough memory available to reallocate the variable, SetLength raises an EOutOfMemory exception.
------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案! 子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問! |
joon
一般會員 發表:35 回覆:41 積分:14 註冊:2004-01-02 發送簡訊給我 |
|
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |