你好,我想知道在调用后如何再次从stdin
中获取输入:
freopen("Smefile.txt","r",stdin);
我希望我的程序首先从指定文件中获取输入,接下来的部分则从标准输入中获取。
例如:
int a,b;
freopen("Smefile.txt","r",stdin);
scanf("%d",&a);
{
//some block here such that the next cin/scanf takes b from standard input
}
cin>> b;
cout <<a<<" "<<b;
有什么想法吗?