// 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,"张珊",95.5f }, { 1018,"李思思",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 data = { 1055, "aaaa", 99 }; m[1055] = data; }