|
|
?????
- /**
- * IndexData ????????????<br>
- * ??????????????int,float?????????????String???????????
- */
- #include<stdio.h>
- #include<hgl/hgl.h>
- #include<hgl/Other.H>
- #include<hgl/IndexData.H>
-
- using namespace hgl;
- void GameMain(int,wchar_t **)
- {
- IndexData<int,String> is_data; //??????String?????????,?int??????,??String??
- IndexData<String,int> si_data; //?????????????????,?String?????,??int??
-
- String data[10]={ L"Hello", L"World", L"Game", L"Byte", L"Phantasy",
- L"Crazy", L"C/C++", L"Basic", L"China", L"Star" };
-
- //??10???
- int n=10;
- while(n--)
- {
- int val=FastRand();
-
- wprintf(L"push %d = %08X %s\n",n,val,data[n].wc_str());
-
- is_data.Add(n,data[n]); //???int?????????
-
- si_data.Add(data[n],val); //???String?????????
- }
-
- n=10;
- while(n--)
- {
- int index;
- int val;
- String str;
-
- index =FastRand(10); //?????????
-
- str =is_data.Get(index); //??int???????
-
- val =si_data.Get(str); //??String???????
-
- wprintf(L"%d = %08X %s\n",index,val,str.wc_str());
- }
- }
复制代码
??????
push 9 = 1C23D2A5 Star
push 8 = BC0E34BD China
push 7 = AB5A72B0 Basic
push 6 = BD563513 C/C++
push 5 = D872C68A Crazy
push 4 = 7FA4B7C9 Phantasy
push 3 = C30029F7 Byte
push 2 = 6E118728 Game
push 1 = FA5B214A World
push 0 = D84F13E8 Hello
6 = BD563513 C/C++
2 = 6E118728 Game
0 = D84F13E8 Hello
6 = BD563513 C/C++
9 = 1C23D2A5 Star
3 = C30029F7 Byte
5 = D872C68A Crazy
9 = 1C23D2A5 Star
9 = 1C23D2A5 Star
8 = BC0E34BD China |
|