Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <vector>
- #include <algorithm>
- #include <string>
- #include <functional>
- struct cmpByStringLength {
- bool operator()(const std::string& a, const std::string& b) const {
- return a < b;
- }
- };
- bool less(std::string a, std::string b)
- {
- return (a <= b); //ABC sorrend
- }
- int main(){
- //std::map<std::string, int, std::less<int>> map_neve;
- //std::map<std::string, int> map_neve;
- std::map<std::string,std::string> mymap;
- mymap["Csongor"] = std::string("Marcius");
- mymap["Balazs"] = std::string("Februar");
- mymap["Panni"] = std::string("December");
- mymap["Orsi"] = std::string("Oktober");
- //std::cout << "A map merete: " << ;
- for(auto it = mymap.begin(); it != mymap.end(); it++)
- {
- std::cout << it->first << "\t" << it->second << std::endl;
- }
- std::map<int,std::string, value_comp> mymap2;
- //std::cout << less("Anna", "Horcsi");
- //mymap2.insert(std::string("Lilla"));
- // mymap2[1] = std::string("Lilla");
- // mymap2[2] = std::string("Lori");
- // mymap2[3] = std::string("Viktor");
- // mymap2[4] = std::string("Geri");
- // for(auto it = mymap2.begin(); it != mymap2.end(); it++)
- // {
- // std::cout << it->first << " - " << it->second << std::endl;
- // }
- // for (std::vector<std::pair<int,std::string>>::iterator it=rendezo.begin(); it!=rendezo.end();it++)
- // {
- // std::cout << it->first << " -> " << it->second << std::endl;
- // }
- //konstruktorba compare
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement