执行顺序问题

 

// 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;
}

 

posted @ 2019-12-13 03:29  火焰马  阅读(101)  评论(0编辑  收藏  举报