遍歷的一些不懂
當(dāng)i=m_iHead=3時(shí),輸出的是m_pQueue[3],然后i++了,i不是就等于4,然后i<m_iQueueLen不就是i<4,那樣程序不就不能運(yùn)行下去了,為什么老師會(huì)說(shuō)之后i就會(huì)是0,1,2
當(dāng)i=m_iHead=3時(shí),輸出的是m_pQueue[3],然后i++了,i不是就等于4,然后i<m_iQueueLen不就是i<4,那樣程序不就不能運(yùn)行下去了,為什么老師會(huì)說(shuō)之后i就會(huì)是0,1,2
舉報(bào)
2017-09-29
遍歷應(yīng)該是
?for?(int?i?=?m_iHead;?i?<?m_iQueueLen?+?m_iHead;?i++)
{
????cout?<<?m_pQueue[i?%?m_iQueueCapacity]?<<?endl;
}