C++ is very specific...
As far as i remember,
uninitialized variables can cause unpredictable results!!!
So, you have to set initial value for
i
variable. You can do it within single line, i.e.:
int i=0;
I'd suggest to read about
type casting[
^]. You should convert char into integer value. You can achieve that by using
atoi function[
^].
For further details, please read this:
Variables and types - C++ Tutorials[
^]