Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,938 questions

51,875 answers

573 users

How to add items to set in C++

1 Answer

0 votes
#include <iostream>
#include <set>

int main()
{
    std::set<int> st;
    
	st.insert(4);
	st.insert(2);
	st.insert(4);
	st.insert(5);
	st.insert(3);
	st.insert(3);
	st.insert(4);
	st.insert(4);
	st.insert(7);
	st.insert(6);

	for (int n:st) {
		std::cout << n << " ";
	}
}




/*
run:

2 3 4 5 6 7 

*/

 



answered Sep 18, 2022 by avibootz
edited Sep 19, 2022 by avibootz

Related questions

1 answer 109 views
109 views asked Sep 29, 2022 by avibootz
1 answer 157 views
1 answer 129 views
129 views asked Apr 23, 2018 by avibootz
1 answer 170 views
1 answer 107 views
107 views asked Mar 4, 2024 by avibootz
1 answer 96 views
96 views asked Mar 4, 2024 by avibootz
1 answer 82 views
82 views asked Feb 27, 2024 by avibootz
...