We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在读取Test.txt文件时,将所有的字符打印到屏幕(line 114) while(!fileIn1.eof()) { fileIn1 >> ch; cout << ch; } 这里会把最后一个字符重新读取两次,因为在读取到最后一个字符时,eof()判断仍为假,这时候就会再进一次函数,但是文件指针仍然停留在最后一个字符,这样最后一个字符就会重复读取。 建议将该段代码改为 while(fileIn1 >> ch) { cout << ch; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在读取Test.txt文件时,将所有的字符打印到屏幕(line 114)
while(!fileIn1.eof())
{
fileIn1 >> ch;
cout << ch;
}
这里会把最后一个字符重新读取两次,因为在读取到最后一个字符时,eof()判断仍为假,这时候就会再进一次函数,但是文件指针仍然停留在最后一个字符,这样最后一个字符就会重复读取。
建议将该段代码改为
while(fileIn1 >> ch)
{
cout << ch;
}
The text was updated successfully, but these errors were encountered: