dev/cpp/bookAmmeraal/06/main.cpp

38 lines
830 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* STL */
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
/* STD */
#include <iostream>
#include <string>
#include <cstdlib>
#include <math.h>
using namespace std;
/* Объединение вектора и массива в список
*/
int main (int argc, char *argv[]) {
vector<int> a(5);
a[0] = 2; a[1] = 3; a[2] = 8;
a[3] = 20; a[4] = 25;
int b[6] = {7, 9, 23, 28, 30, 33};
list<int> c; // Список с начала пуст
merge(a.begin(), a.end(), b, b+6, inserter(c, c.begin()));
list<int>::iterator i;
for (i=c.begin(); i != c.end(); ++i)
cout << *i << " ";
cout << endl;
return 0;
}