276
public text v1 · immutable#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string.h>
using namespace std;
int Hasher (string & word) {
int hash = 0;
for (uint i = 0; i<word.length(); i++) {
hash += (int) word[i] * (i+3);
}
hash = hash % 500;
cout << hash << endl;
return hash;
}
int main () {
ifstream infile ("dictionary.txt");
string word;
while(infile.good() ) {
getline(infile, word);
Hasher(word);
}
return 0;
}