MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/map/mapConcepts.cpp:4–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include<bits/stdc++.h>>
3using namespace std;
4int main() {
5
6//Map: Commom use- counts frequency of various objects
7//Maps are special arrays in which the indices(keys) of elements can be negative or very big or even strings!
8
9// map<key_datatype, value_datatype> m;
10
11map<string, int>m; //defines a map in which the keys of elements are strings.
12m["hello"]=50;
13m["world"]=12;
14cout<<m["hello"]<<" "<<m["world"]; //50 12
15
16//Maps are very similar to sets, in sets the values are unique and sorted. In maps, the keys are unique and sorted(lexicographically).
17return 0;
18}
19```

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected