My program uses a hash to find matches between two files. My problem is that i need to figure out how long it takes the program to find these matches. i need to use some sort of time function or something to do this but im not sure what to do. If anyone could help that would be awesome because this is due in a few hours.
//create array A and read strings from file
unsigned int *hash;
hash = new unsigned int [count];
string *A= new string[count];
for(int i=0;i<count;i++) {
fin >> A[i];
hash[i] = RSHash(A[i]);
}
//re-open step2 file
fin2.open("password.txt");
//create array B and read strings from file
unsigned int *B=new unsigned int[countnew];
for(int j=0;j<countnew;j++) {
fin2 >> B[j];
}
//call on function
matchingwords(count, countnew,hash,B,A);
cout << endl;
return 0;
}
//-------------------------------------------------------
unsigned int RSHash( string &str ) {
unsigned int b = 378551;
unsigned int a = 63689;
unsigned int hash = 0;
for( int i = 0; i < str.length(); i++ ) {
hash = hash * a + str[i];
a = a * b;
}