Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i need to make a simple hash function for an id in my size_t function it works i

ID: 3729390 • Letter: I

Question

i need to make a simple hash function for an id in my size_t function it works it need to print out numeric numbers and it has to be six numbers i think i need a loop here what it print out and i just want the number to be more random then same number over and over

input.txt

bob 4517898 102 tell rd

gill 4787456 103 hmm rd

output.txt

126990 bob 4517898 102 tell rd

126990 gill 4787456 103 hmm rd

#ifndef __CUSTOMER_H__
#define __CUSTOMER_H__

#include
#include

struct customer
{
   std::string name;
   std::string phone;
   std::string address;

   std::size_t hash() const;
};

inline std::istream& operator>>(std::istream& is, customer& m)
{
   is >> m.name >> m.phone >> e.address;
   std::getline(is, e.Address);
   return is;
}

inline std::ostream& operator<<(std::ostream& os, const customer& m)
{
   os << m.name<< " " << m.phone << " " << m.address;
}

#include

#include "customer.h"


std::size_t customer::hash() const
{

    std::hash<std::size_t>m;

    std::size_t id=1245;

    id =(id*101)+m(id);

    return id;


  
}

Explanation / Answer

Use rand() function get generate the random number

below code will generate the 6 digits ranodm numbers

int num = (rand() + 111111) % (999999+ 1);