Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

练习3.23未使用题目要求的迭代器要求 #90

Open
LeoTao777 opened this issue May 18, 2022 · 0 comments
Open

练习3.23未使用题目要求的迭代器要求 #90

LeoTao777 opened this issue May 18, 2022 · 0 comments

Comments

@LeoTao777
Copy link

练习要求使用迭代器将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;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant