This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
因为类型不匹配!
您将“diff”定义为字符并在 switch 语句中使用它。但是,在第二个 switch 语句中,您删除了引号并将其用作数字。这会导致根据 ascii 表进行 char 到 int 的转换。
看一下十进制字段,作为 int 的数字 1 对应于现实生活中很少见到的不可打印字符。字符“1”对应49。
解:
Because of type mismatch!
you defined "diff" as a char and use it as such in your switch statement. However, in your second switch statement, you remove the quotes and use it as a number. That causes a char to int conversion according to the ascii table.
Look at the decimal field, the number 1 as an int corresponds to a non-printable character that you will rarely see in real life. The character '1' corresponds to 49.
Solution:
对于这一行,
您的意思是
考虑到 diff 是键入的 char 而不是 int
for this line
you mean
given that diff is a typed in char not an int