//这个程序的作用是输入一段字符串,当你按下回车键,则屏幕输出你输入的字符串。EOF是End Of File 的缩写,表示“文件结束”。返回一个 Integer,它包含 Boolean 值 True,表//明已经到达为 Random 或顺序 Input 打开的文件的结尾。
#include <cstdio>
#include <iostream>using std::cin; using std::cout; using std::endl;
int main()
{
char ch; // using a char here invites disaster!
// the return from cin.get is converted to char
// and then compared to an int
while ((ch = cin.get()) != EOF)
cout.put(ch);
cout << endl;
return 0;
}