我可以知道如何纠正此错误吗? [英] May i know how to correct this error?

查看:58
本文介绍了我可以知道如何纠正此错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符R = 110110101;
字符y =! R;

char R = 110110101;
Char y = ! R;

推荐答案

由于char数据类型接受
单个Unicode字符,因此在您的情况下,它将仅接受单个字符1
查看链接可能对您有帮助

http://msdn.microsoft.com/en-us/library/7sx7t66b%28v = vs.71%29.aspx
As char data type accepts
A single Unicode character so it will accepts only single char in your case 1
see the link it may help you

http://msdn.microsoft.com/en-us/library/7sx7t66b%28v=vs.71%29.aspx


如果要使用二进制值110110101,请使用十六进制等效项0x1B5(或十进制437):
If you want to use the binary value 110110101 then you use the hexadecimal equivalent 0x1B5 (or decimal 437):
char R = (char) 0x1B5;







or

char R = (char) Convert.ToInt32( "110110101", 2 );



我不得不使用强制类型转换:这暗示char可能不是此类表达式中的最合适的类型".
注意!逻辑非运算符,它是为boolean操作数定义的(不是您指的是~吗?).



I had to use casts: it is an hint that possibly char is not the ''most suitable type'' in such expressions.

Beware ! is the logical not operator, defined for boolean operand (did you mean ~ instead?).


这篇关于我可以知道如何纠正此错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆