background image

else

{

if (m_nRadio == 0)

m_pStudent = (CStudent*)m_List.RemoveHead();

else if(m_nRadio == 1)

m_pStudent = (CStudent*)m_List.RemoveTail();

else 

{

if(nNumber < m_List.GetCount())

{

          POSITION pos = m_List.FindIndex(m_nNumber);

          POSITION pos1 = pos;

          m_pStudent = (CStudent*)m_List.GetNext(pos1);

             m_List.RemoveAt(pos);

}

else

{

MessageBox("指定结点超出范围!"

;

}

}

if(m_pStudent)

delete m_pStudent;

}
遍历链表

POSITION pos = m_List.GetHeadPosition();

while (pos != NULL)

{

CStudent* m_pStudent = (CStudent*) m_List.GetNext(pos);

char s[81];

wsprintf(s, " 

 

的成绩是 %d.",m_pStudent->m_nScore);

CString m_string=m_pStudent->m_strName+s;

}

CString 类
一、常用成员函数

1.int GetLength

   

( ) const;

说明:获取 CString 类对象包含字符串的长度(字符数)。

2.BOOL IsEmpty

   

( ) const;

说明:测试 CString 类对象包含的字符串是否为空。

3.void Empty

 

( );

说明:使 CString 类对象包含的字符串为空字符串。

4.TCHAR GetAt

 

( int nIndex   

) const;