如何擺脫標識符未找到錯誤?函數依賴於另一個函數
例如:
int step1(int a, int b)
{
if (b == a)
{
cout << "They are the same." << endl;
return 0;
}
else
{
step2(a, b);
}
}
int step2(int a, int b)
{
if (a > b)
{
a = a - b;
step1(a, b);
}
if (b > a)
{
b = b - a;
step1(a, b);
}
}
int main()
{
int a = 1;
int b = 2;
step1(a, b);
}
如果代碼是象上述的「步驟1」的運行時錯誤的示例設置:未發現會出現標識符,但如果我是放置上述步驟1功能的步驟2功能,那麼運行時錯誤'step2':找不到標識符。我該如何改變這一點,以便將來沒有任何錯誤?
[簡單C++錯誤: 「......未聲明(第一次使用此功能)」]的可能的複製(http://stackoverflow.com/questions/1354522/simple-c-錯誤不宣首先使用,這個功能) – Default