Hopefully you'll know what an "isbn" is (International Standard Book Number). Well i have to make a program that gives me the area, publisher and tittle number from a valid isbn number.
ie.
the isbn number: 0003194876 is valid and the area number is: 0, publisher is: 00 and title is 319487 and the number six in the isbn number is the check digit.
so one isbn number is split into 4 seperate ones. I have to use a file that is basically a list of valid area and publisher numbers. the first column is the list of area numbers valid and the second is minimum number in that specific publisher range while the other is maximum
File text link
ie.
the first rown has
0 is the area, 00 is min for publisher and 19 is max
Basically i have to check the first number in a isbn string see if its in the list on the first column when i find a area that works i check for the publisher...if i don't find a area for the first digit i check the first and second and so on until i find.
Code:
int decode(FILE* fp, const char* str, char* area, char* publisher, char* title){
while (!feof(fp)) {
fscanf(fp, "%s %s %s\n", c, d, e);
}
return 0;
}
^^ this is the function im going to use, so far i just have a fscanf working
What i need is some advice on how to start it, like how can i save the first character in "str" and check if their is a valid area number for that digit.