I am writing a program to validate an isbn number. In my code I am instantiating an array of chars. Then I am trying to read in what the user types in (isbn number) and assign it to the array. I need to be able to maniupulate (add and multiply) some of the numbers in the isbn, but when I try to print out the first value in the array 'isbn' it gives me the ascii dec of the number, instead of the number itself. When testing this out so far, the isbn number I used starts with a '0' and when I printed it out, it printed out '48' instead of 9 (48 is the dec number on the asii table). I'm not really sure what that dec is anyway, so if someone could explain this and explain how to get the actual numbers from the isbn number instead of the dec value I would greatly appreciate it. Thank you.
Firstly edit your post so it uses code tags - the <> button on the right.
Next, what are try achieve with this:
char isbn[0];
How many chars will that hold? Why are you not using strings?
What you need to realise is that a char is just a small int. '0' is a user friendly representation of the decimal (integer) 48. So to print '0' or 'a' or 'Z' or whatever the type needs to be char.
cout << isbn << endl;
That doesn't do what you think. It prints the address of the array (a pointer or memory address). IF isbn was a string - it would work.