this is a very simple explanation of how maps works .
at your level just of it like this .Maps are just array but the index can be anything.
a good exemple is you can declare map<string,int> mp. mp will have a key of type string. so you can do for exemple
Spoiler
map<string,int>mp;
mp["first"]=20;
mp["second"] = 30;
cout<<mp["first]<<"\n";
but you can't do this with arrays .
Also wikipedia was right about find .There is this thing in c++ called iterators. you can use find on everything that has iterators like this
map<string,int>mp;
mp["first"]=20;
mp["second"] = 30;
cout<<mp["first]<<"\n";
auto it = find(mp.begin(),mp.end(),"second");
cout<<it->first<<" "<<it->second<<"\n";
in the code above find returns an iterator of type pair<string,int> you can access the key using it->first and you can access the value using it->second .
this is a very simple explanation of how maps works .
at your level just of it like this .Maps are just array but the index can be anything.
a good exemple is you can declare map<string,int> mp. mp will have a key of type string. so you can do for exemple
Spoiler
map<string,int>mp;
mp["first"]=20;
mp["second"] = 30;
cout<<mp["first]<<"\n";
but you can't do this with arrays .
Also wikipedia was right about find .There is this thing in c++ called iterators. you can use find on everything that has iterators like this
in the code above find returns an iterator of type pair<string,int> you can access the key using it->first and you can access the value using it->second .