Can anyone tell me how to compare a string to an integer? I have a SSN stored as a string, SSN[10]. I need to compare each number in the SSN. What I need to do is to add up the ASCII values of the SSN to use for a hashing function. For example, the SSN is 222116666. I need to add the ASCII values up: 50 + 50 + 50 + 49 + 49 + 54 + 54 + 54 + 54 = 464.
strcmp() does not work comparing a string and an integer. I have the string class and tried it that way (declaring SSN as a string type) but then it will not let me use get(SSN) to read the SSN. Any suggestions? Thanks a lot.
tat2dlady 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.