An unordered container is a type of container in which elements are not stored in
a specific order, unlike ordered containers such as vector or list. C++ provides
several unordered containers, including unordered_map, unordered_set, and 
unordered_multimap.

Here is an example program that demonstrates the use of the unordered_map 
container:

Copy code
#include <iostream>
#include <unordered_map>

int main() {
    // Create an unordered_map of integers to strings
    std::unordered_map<int, std::string> map;
    
    // Insert elements into the map
    map.insert({1, "one"});
    map.insert({2, "two"});
    map.insert({3, "three"});
    
    // Search for an element in the map
    auto search = map.find(2);
    if (search != map.end()) {
        std::cout << "Found: " << search->first << " " << search->second << std::endl;
    } else {
        std::cout << "Not found" << std::endl;
    }
    
    // Iterate through the elements in the map
    for (const auto& element : map) {
        std::cout << element.first << " " << element.second << std::endl;
    }
    
    return 0;
}
This program creates an unordered_map container of integers to strings, and then 
inserts three elements into the map. It then searches for the element with the key
2, and if it is found, it prints the key-value pair. Finally, it iterates through
all the elements in the map and prints their key-value pairs.

You could use unordered_set in a similar way, but it only stores the keys and no
values. unordered_multimap is similar to unordered_map, but it allows multiple
elements to have the same key.

Embed on website

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