Advertisement
Guest User

Source

a guest
May 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include "HashTable.h"
  2. #include <iostream>
  3.  
  4. int hashCode(const std::string &elem) {
  5.     int sum = 0;
  6.     for (int k = 0; k < elem.length(); k++) {
  7.         sum = sum + int(elem[k]);
  8.     }
  9.     return  sum;
  10. }
  11.  
  12. int main() {
  13.     HashTable<std::string> tbl(hashCode);
  14.  
  15.     tbl.add("Hello");
  16.     tbl.add(", My");
  17.     tbl.add("Name");
  18.     tbl.add("is");
  19.     tbl.add("Arthur");
  20.     tbl.add("and");
  21.     tbl.add("it's");
  22.     tbl.add("my");
  23.     tbl.add("fucking");
  24.     tbl.add("shit");
  25.     tbl.add("code");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement