View Single Post
Old May 3, 2004 | 08:26 PM
  #1  
1stGenCRXer's Avatar
1stGenCRXer
GWAKS- Tech Geekifier
 
Joined: Oct 2000
Posts: 2,109
Likes: 0
From: Hampton, VA
Default Calling all code monkeys!

I have a bit of a problem with a bloom filter I"m working on, all help would be appreciated, here's the code and errors I'm getting so far:

Originally Posted by code
#include <iostream>
#include <string>

using namespace std;

unsigned long elfhash(char* key)
{
unsigned long h=0,g;
while(*key){
h=(h<<4)+*key++;
if((g=h&0xF0000000L))
h^=g>>24;
h&=~g;
}
return h;
}

int main(void){

int bloom[16];
int h1, h2, h3;
unsigned long h;
char key[15];

while(cin){
cin.get(key);
h = elfhash(key);
h1 = h%15;
h2 = (h%13)+2;
h3 = (h%11)+3;
cout << key << " " << h1 <<","<<h2<<","<<h3;
}
return 0;
}
Originally Posted by errors
[XXXXX@XXXXX final]$ bloom.cpp: In function `int main()':
> bloom.cpp:26: no matching function for call to `std::basic_istream& std::basic_istream::get(_CharT&) [with _CharT = char, _Traits =
-bash: char,: No such file or directory
std::char_traits]
__________________
-Harry
AIM: NDcissive
CRX and Pre '92 Civic, Engine Tech and Tuning, & Track and Autocross Forum Mod
Reply