Скачиваний:
33
Добавлен:
10.05.2014
Размер:
426 б
Скачать
#include <iostream>
#include <string.h>

#define N 20

using namespace std;

char y[7];
int key;

int Rash_2(char x[])
{
	int StringLength,HashKey,i,tmp;
	StringLength=strlen(x);
	HashKey=0;
	for (i=0; i<=StringLength; i++) {HashKey=HashKey+x[i];}
	tmp=HashKey/100;
	HashKey=HashKey-99*tmp;
	if (HashKey>N) {HashKey=HashKey%N;}
	return HashKey;
}

int main(void)
{
	strcpy(y,"a5bf5");
	key=Rash_2(y);
	cout<<key;
	return 0;
}
Соседние файлы в папке 3