#include ‹iostream.h›
#include ‹stl.h›
int array[3] = {1, 2, 3};
int main() {
replace_if(array, array + 3, bind2nd(greater‹int (), 2), 4);
for (int i = 0; i ‹ 3; i++) cout ‹‹ array[i] ‹‹ endl;
return 0;
}
vec5.cpp
#include ‹iostream.h›
#include ‹stl.h›
int array[] = {1, 4, 9, 16};
int main() {
vector‹int› v(array, array + 4);
for (int i = 0; i ‹ v.size(); i++) cout ‹‹ 'v[' ‹‹ i ‹‹ '] = ' ‹‹ v[i] ‹‹ endl;
return 0;
}
iterswp0.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[6] = {0, 1, 2, 3, 4, 5};
int main() {
iter_swap(numbers, numbers + 3);
for (int i = 0; i ‹ 6; i++) cout ‹‹ numbers[i] ‹‹ ' ';
cout ‹‹ endl;
return 0;
}
remove1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[6] = {1, 2, 3, 1, 2, 3};
int main() {
remove(numbers, numbers + 6, 1);
for (int i = 0; i ‹ 6; i++) cout ‹‹ numbers[i] ‹‹ ' ';
cout ‹‹ endl;
return 0;
}
stblsrt1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int array[6] = {1, 50, -10, 11, 42, 19};
int main() {
stable_sort(array, array + 6);
for (int i = 0; i ‹ 6; i++) cout ‹‹ array[i] ‹‹ ' ';
cout ‹‹ endl;
return 0;
}
reverse1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[6] = {0, 1, 2, 3, 4, 5};
int main() {
reverse(numbers, numbers + 6);
for (int i = 0; i ‹ 6; i++) cout ‹‹ numbers[i] ‹‹ ' ';
cout ‹‹ endl;
return 0;
}
logicnot.cpp
#include ‹iostream.h›
#include ‹stl.h›
bool input[7] = {1, 0, 0, 1, 1, 1, 1};