i need a c++ prog that will perfrorm the following operations (written in java) and return the variable "chk" to the user, but I'm having troubble with converting some of it...
Code:
function isSSN(ssn1, ssn2) {
var chk = 0 ;
for (var i = 0 ; i <= 5 ; i++) { chk = chk + ((i % 8 + 2) * parseInt(ssn1.substring(i, i+1))) }
for (var i = 6 ; i <= 11 ; i++) { chk = chk + ((i % 8 + 2) * parseInt(ssn2.substring(i-6, i-5))) }
chk = 11 - (chk % 11) ;
chk = chk % 10 ;
return true ;
}