#include <iostream>
using namespace std;
char GetChar(istream&in=cin)//从输入流in中跳过空格以获取一字符
{
char ch;
int a=1;
while(!in.eof()&&(ch=in.get())==' ');//先读取到文件结束符再结束
return ch;
}
int main()
{
char ch;
cout<<"请输入一行字符:"<<endl;
ch=GetChar();
while(ch!='%'&&ch!='\n')
{
//cout<<"1111"<<endl;
cout.put(ch);
ch=GetChar();
}
cout<<endl;
system("PAUSE");
return 0;
}
eof()
最新推荐文章于 2023-05-10 21:32:45 发布