Answer the question
In order to leave comments, you need to log in
How to print the contents of a set in C++?
Hello!
I have created a set in C++. Can you please tell me how to display all its contents on the screen?
I remember that this can be done somehow through set.end (), but I can’t write it correctly.
Answer the question
In order to leave comments, you need to log in
for (const auto &i:myset)
{
cout << i << endl;
}
for (std::set<что-то>::iterator i=myset.begin();i!=myset.end();++i)
{
cout << (*i) << endl;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question