还是关于程序中读取的问题,求帮忙
刚开始,我将数据写到vector<int>里面,现在在不重新用键盘输入的前提下,就是不关程序,我想将vector里面的数据重新读出来写进其他东西里面,
我想用的代码是这样,
void ArrayDown(position p,vector<int> vec1)
{
iostream inout;
int temp;
for (auto s:vec1)
{
inout<<s;
}
MakeNull(p);
while (inout>>temp)
{
Insert(temp,p,1);
}
}
其中,vec1已经确保有数据,MakeNull和Insert只是我作业要用的函数,但iostream是protected不好用,新手表示懵了,之前问了用stringstream可以读写字符流,但整数就不能用iostream了。