Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- #include<string.h>
- using namespace std;
- int hashFunc(char* str)
- {
- int sum = 0;
- for(int i = 0;i<strlen(str);i++)
- {
- sum = sum + (int)str[i];
- }
- return sum % 73;
- }
- int main()
- {
- cout <<"hashFunc("<<"slon) = "<< hashFunc("slon")<<endl;
- cout <<"hashFunc("<<"olsn) = "<< hashFunc("olsn")<<endl;
- cout <<"hashFunc("<<"cat) = "<< hashFunc("cat")<<endl;
- cout <<"hashFunc("<<"dog) = "<< hashFunc("dog")<<endl;
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement