#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

int main() {
    std::vector<int> a{9, 5, 3, 1};
    std::vector<int> b{0, 8, 6, 4};
    std::map<int, int> arr;

    // Insert elements from vectors `a` and `b` into the map `arr`
    for (int i = 0; i < a.size(); i++) {
        arr[a[i]] = b[i];  // or arr.insert({a[i], b[i]});
    }

    // Output the contents of the map
    for (auto &i : arr) {
        std::cout << ' ' << i.first << ' ' << i.second << std::endl;
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: