Because it is a character array (char), the numbers are being stored as ascii code http://www.asciitable.com/
You can see in the table that the numbers are 48 places away from their equivalent numeral. i.e.
0 is represented by 48
1 is represented by 49
etc...
So, to convert them to an integer, you must subtract 48.
Also, do not use void main(), use int main!!! Void main won't even compile on some compilers (such as mine). It is not correct C++. It should be int main and that should generally return 0 for a correct run, or (traditionally) 1 for an error.
1 2 3 4 5 6 7 8 9 10 11 12
int main()
{
//stuff
if(error in the stuff)
{
return 1;
}
else
{
return 0;
}
}