Hi everyone
In Python, I know how the following works:
An empty set is first defined.Code:>>> SET = [] >>> SET.append(1) >>> print SET [1]
The integer 1 is added/appended to the set.
The set is printed, having one new element instead of being empty.
How would I go about doing this in C++?
Would it look something like this?
Code:#include <iostream> #include <set> using namespace std; int main() { set<int> SET; SET.insert(1) cout << SET << endl; }
I tried doing that but I got an error saying
no match for 'operator<<' in 'std::cout << SET'
I am using DevC++ 4.9.9.2 and Python 2.7
Thank you all in advance![]()



LinkBack URL
About LinkBacks




