This could be your problem:
char ch="j";
You make a
char
variable, i.e. a single character. Now,
"j"
in double quotes is a
string literal. That is, it is a constant string of characters (technically, a pointer to a constant string of characters), which in this case just happens to be one character.
If you want to represent a single character as a character type, put it in single quote marks:
'j'
Question 2:
I wonder how Capital=Capital+Capital can be? |
Obviously, it doesn't make sense as a mathematical equation. However, as far as our program is concerned, the original value of capital is added to itself, and
then this new value is assigned to the variable. So the value of
Capital
doesn't change until after the addition is performed.