在我的課本從輸入倒車線,有這種例子非常相似這扭轉從輸入文件中的一行:使用遞歸函數
void Reverse(ifstream &inFile, int level)
{
int myInput = inFile.get();
if (myInput != '\n' && myInput != EOF) // don't understand this, line 4
Reverse(inFile, level);
if (myInput != EOF)
cout.put(myInput);
}
我不明白的是我評論線。因爲從的輸入是輸入文件:
ABC\n
DEF\0
當\ n等於myInput,不使其4號線的條件語句成爲自第一(myInput =「\ n」!)是假的假,第二部分(myInput!= EOF)是真的,使整行爲假,而不是再次調用Reverse函數?謝謝。