练习3.23未使用题目要求的迭代器要求
LeoTao777 opened this issue · comments
练习要求使用迭代器将vector中的整数变为两倍,作者使用的是范围for循环。
我的程序代码如下,如有问题还请作者提出。谢谢!
#include
#include
using namespace std;
int main(void)
{
vector<int> s(10,42);
for (auto i = s.begin(); i != s.end(); i++)
{
*i = 2 * (*i);
cout << *i << ", ";
}
cout << endl;
system("pause");
return 0;
}