how to print first and last element of set using cout
Set printing problem
You can do it using this way:
set::iterator i;
i = s.begin();
cout << *i;
for last element:
set::reverse_iterator i;
i = s.rbegin();
cout << *i;
how to print first and last element of set using cout
You can do it using this way:
set::iterator i;
i = s.begin();
cout << *i;
for last element:
set::reverse_iterator i;
i = s.rbegin();
cout << *i;