1. EOF介绍 EOF 是 End of File 的缩写。 C 语言中,它是在标准库中定义的一个宏。 2. 使用方法 windows下 ctrl+z表示结束输入 #include <iostream> using namespace std; int main() { char ch; while ((ch = cin.get()) != EOF) //ctrl+z表示结束输入 cout.put(ch); return 0; } linux下 ctrl+D表示结束输入