Created
July 29, 2014 18:11
-
-
Save vaishaks/3ef752bb63300ce4f296 to your computer and use it in GitHub Desktop.
Using a hashtable in C++
This file contains 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 "stdafx.h" | |
#include <iostream> | |
#include <string> | |
#include <unordered_map> | |
#include <conio.h> | |
using namespace std; | |
int main() | |
{ | |
unordered_map<string, string> hashTable; | |
hashTable["foo"] = "bar"; | |
hashTable.insert(pair<string, string>("vaishak", "salin")); | |
cout<<hashTable["foo"]<<" "<<hashTable["vaishak"]<<endl; | |
for (auto i = hashTable.begin(); i != hashTable.end(); ++i) { | |
cout<<i->first<<" "<<i->second<<endl; | |
} | |
_getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment