Created
May 28, 2014 10:35
-
-
Save mudream4869/23fcfcadaa77e4e16120 to your computer and use it in GitHub Desktop.
range in map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<map> | |
| #include<cstdio> | |
| #include<cstdlib> | |
| typedef std::map<int, int> mic; | |
| typedef std::map<int, int>::iterator itmic; | |
| int main(){ | |
| mic mmap; | |
| itmic it; | |
| for(int lx = 0;lx < 100000;lx++) | |
| mmap[lx] = (lx*lx + 1)%1932712; | |
| itmic start = mmap.find(20); | |
| itmic end = mmap.find(100); | |
| end++; | |
| for(itmic it = start;it != end;it++){ | |
| printf("%d -> %d\n", it->first, it->second); | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment