程序死循环怎么解决!! 急
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{ char ch;
int a;
char buffer1[80];
char buffer2[80];
while((a=cin.get())!=EOF)//EOF的值是-1,如何输入才能跳出循环
cout.put(a);
cout<<"EOF is:"<<a<<endl;
cout<<"ok"<<endl;
cout<<"after input,cin.eof():"<<cin.eof()<<endl<<endl;
cin.clear();
while(cin.get(ch))//如何输入才能跳出循环
cout.put(ch);
cout<<"Ok"<<endl;
cin.clear();
cin>>buffer1;
cout<<"the 1part:"<<buffer1<<endl;
cin.get(buffer2,20);
cout<<"the 2part:"<<buffer2<<endl;
return 0;
}