// Compile this code without defining the symbol OS_USE_EXCEPTIONS.
int main() {
vector‹int› v;
v.pop_back(); // Generates an empty object error.
return 0;
}
pair0.cpp
#include ‹stl.h›
#include ‹iostream.h›
int main() {
pair‹int, int› p = make_pair(1, 10);
cout ‹‹ 'p.first = ' ‹‹ p.first ‹‹ ', p.second = ' ‹‹ p.second ‹‹ endl;
return 0;
}
pair1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int main() {
pair‹int, int› p = make_pair(1, 10);
cout ‹‹ 'p.first = ' ‹‹ p.first ‹‹ ', p.second = ' ‹‹ p.second ‹‹ endl;
return 0;
}
minelem1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[6] = {-10, 15, -100, 36, -242, 42};
int main() {
cout ‹‹ *min_element(numbers, numbers + 6) ‹‹ endl;
return 0;
}
maxelem1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[6] = {4, 10, 56, 11, -42, 19};
int main() {
cout ‹‹ *max_element(numbers, numbers + 6) ‹‹ endl;
return 0;
}
max1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int main() {
cout ‹‹ max(42, 100) ‹‹ endl;
return 0;
}
min1.cpp
#include ‹stl.h›
#include ‹iostream.h›
int main() {
cout ‹‹ min(42, 100) ‹‹ endl;
return 0;
}
adjdiff0.cpp
#include ‹stl.h›
#include ‹iostream.h›
int numbers[5] = {1, 2, 4, 8, 16};
int main() {
int difference[5];
adjacent_difference(numbers, numbers + 5, difference);
for (int i = 0; i ‹ 5; i++) cout ‹‹ numbers[i] ‹‹ ' ';