Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <map>
- #include <fstream>
- #include <string>
- #include <vector>
- #include <windows.h>
- #include <iostream>
- int main()
- {
- std::vector<std::string> List;
- std::string line;
- std::map<std::string, bool> Dict;
- DWORD TC = GetTickCount();
- std::ifstream input("test.txt");
- while(!input.eof())
- {
- input >> line;
- List.push_back(line);
- }
- std::cout << "Reading file speed: " << GetTickCount() - TC << " ms." << std::endl;
- TC = GetTickCount();
- for(int i = 0; i < List.size(); i++)
- {
- Dict[List[i]] = true;
- }
- std::cout << "Adding to the dictionary: " << GetTickCount() - TC << " ms." << std::endl;
- TC = GetTickCount();
- bool b = false;
- for(int i = 0; i < List.size(); i++)
- {
- b = Dict[List[i]];
- if(!b)
- break;
- }
- std::cout << "Dictionary reading: " << GetTickCount() - TC << " ms." << std::endl;
- TC = GetTickCount();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement