VC++中list的使用方式

/*by:rush date:2011年7月24日 15:52:43*/

下面这段程序演示了在MFC中list的使用方式。

 1 CPtrList list;
2 int i = 0;
3 CPoint *point = NULL;
4 for (;i<10;i++)
5 {
6 point = new CPoint();
7 point->x = i;
8 point->y = i;
9 list.AddTail(point);
10 }
11 ///È¡³öÀ´
12 CString str;
13 CString s = ""
14 for (i = 0 ; i < list.GetCount() ; i++)
15 {
16 POSITION pos = list.FindIndex(i);
17 CPoint *pp = (CPoint *)list.GetAt(pos);
18 str.Format("{x=%d,y=%d}\n",pp->x,pp->y);
19 AfxMessageBox(str);
20 }
原文地址:https://www.cnblogs.com/rushoooooo/p/2115429.html