// BUG typedef struct SData { int nNumb; char szName[20]; float fMath; }DATA; #include "stdafx.h" #include "Map.h" #include <iostream> using namespace std; int main () { DATA ds[] = { { 1008 , " Zhang Shan " , 95.5f }, { 1018 , " Li Sisi " , 100 }, }; CMap m; int nIndex = -1; int k = _countof(ds); // while (++nIndex < _countof(ds)) while (nIndex < _countof(ds)) { m.SetAt(ds[nIndex].nNumb, ds[nIndex]); ++nIndex; } VALUE value = m[1023]; DATA time = { 1055 , " yyyy " , 99 }; m[1055] = data; }