### check validation of Isbn number

isbn
Last edited on

http://www.cplusplus.com/reference/iostream/istream/getline/

getline takes a char* and a size. What are you trying to pass it? An int*.

Weighted Sum = 110

Since the weighted sum calculated = 110, the weighted sum modulus 11 is therefore zero, it a valid isbn
Last edited on
You missed the point entirely.

getline does NOT take an int*. You are trying to feed it an int*.

Here, see this line of code:
`cin.getline(num,10);` num should be a char*. It is not. Do you understand?
OP for reference:

 hey anybody help,this is freezing my mind. i suppose to write a program wich takes 10 digits including 'X' some time from the user and check the validation of isbn dividing by 11.i try a program but dosent take number from user.pleas help. #include #include #include #include #include using namespace std; int main() { const char*str; int num[10]; int check = 0, i,val = 0, mod = 1, length = 0; cout<<"enter the isbn number"< '9') check = 0; else num[i] = str[i] - '0'; } if (check != 0) //the first 9 characters are digits, make sure 10th char is either a digit or letter X (10). Propagate 10th num array position with numerical value. { if (str[9] < '0' || str[9] > '9' && str[9] != 'X') check = 0; else if (str[9] == 'X') num[9] = 10; else num[9] = str[9] - '0'; } if (check != 0) //do the math to make sure it's all modulo 11 { for (i = 0; i < 10; i++) { val += num[i] * (10 - i); } mod = val % 11; if (mod != 0) check = 0; } } // if statement about there being 10 system("pause"); return check; }