I'm just a second year college student in Computer Science so please be nice..:)
I have this course requirement where we were asked to make a program about any hashing technique. I chose Division because it's easier.
Anyways, I'm having a hard time in getting the "highest prime number". When I just use the inputed File Size, the output always show the hashed address of the second inputed number..
#include<iostream.h>
void main() {
int N, i,h, b, HP, r, l, m;
cout<<"Enter File Size: "; cin>>N;
cout<<endl;
if((N%2)==1) {
cout<<"Highest Prime Number: "<<N;
}
cout<<endl;
cout<<"Enter number of inputs: "; cin>>h;
for(i=1; i<=h; i++) {
cout<<"Enter numbers: "; cin>>b;
}
cout<<"Hashed Addresses: "<<endl;
for(r=1; r<=h; r++) {
HP = b / N;
l=HP*N;
m=b-l;
cout<<m<<endl;
}
cout<<endl;
}
please help me...:'(