以下代码如果不用GOTO的话,应该怎么改,请高手帮忙看看
int m_Count = 0;
int index = 5;
A:
m_Count4 = index + 1;
goto C;
B:
if (m_Data[index] == m_Data[m_Count4])
{
m_Count++;
}
m_Count4++;
C:
m_Count5 = 9;
if (m_Count4 <= m_Count5)
{
goto B;
}
index++;
m_Count5 = 8;
if (index <= m_Count5)
{
goto A;
}

    return m_Count;

解决方案 »

  1.   

    建议你:  在变成当中 少用 最好是不用 goto语句
      

  2.   

    goto 可以用其他语句代替。以后能不用就不用吧 goto不是个什么好东西 
      

  3.   

    既然这样没问题,何必要动脑筋改,有可能还会引入新bug再说有些过程也只能用goto写。
      

  4.   


    int m_Count = 0;
        int index = 5;
    /////////////////////
    m_Count4 = index + 1;
    m_Count5 = 9;
    while(m_Count4 <= m_Count5)
    {
    if (m_Data[index] == m_Data[m_Count4])
    {
    m_Count++;
    }
    m_Count4++;
    }
        index++;
        m_Count5 = 8;
    while(index<=m_Count5)
    {
    m_Count4 = index + 1;
    m_Count5 = 9;
        while(m_Count4 <= m_Count5)
    {
    if (m_Data[index] == m_Data[m_Count4])
    {
    m_Count++;
    }
    m_Count4++;
    }
    index++;
    m_Count5 = 8;
    }
     return m_Count;
      

  5.   

    goto这种语句,简直是太难扩展和维护了
      

  6.   

    goto没有错,有错的只能是人,存在即合理
      

  7.   

    确实是太难改拉,谢谢binsir543 的热心帮助