第3个回答 2014-10-28
?
int是整型,就是我们平常说的12345这些数字。
char是字符型,就是我们平时说的a,b,c,d这些。
char a,b和int a,b中的a,b只是变量名,就是给这些东西起个代号。
比如人和猪是两个类型,小明可以指的是人,也可以指的是猪,这只是个代号。
注意的是int型的变量赋值只能用数字。
追问谢谢,只能采纳一个答案,我就采纳了第一个,你的答案也很棒的,真心感谢你!!
第4个回答 2014-10-28
char has been reinterpreted as a single Character, not the same as byte.
When getting input, char can only match one char such as 'a', 'b', '1', 'c'.
int is treated as a number, so when getting input, int will get char-sequence and try to translate to a number, such as a char sequence like '1', '2', '3' ' ' will be merge to a number 123 to a int, and '1','2','a',' ' will get an error as it can't be translate to int...