if (Console.CursorTop=3 && Console.CursorLeft==7) {
Console.WriteLine();
}
Error 1 Operator '&&' cannot be applied to operands of type 'int' and 'bool'
为什么不工作?
if (Console.CursorTop=3 && Console.CursorLeft==7) {
Console.WriteLine();
}
Error 1 Operator '&&' cannot be applied to operands of type 'int' and 'bool'
为什么不工作?
不要你的意思(注意双等号)
Console.CursorTop == 3
其他明智的分配。
纠正你的语法,替代= 3 == 3
if (Console.CursorTop==3 && Console.CursorLeft==7)
{
Console.WriteLine();
}
如果你想CursorTop比较3,那么你需要if (Console.CursorTop==3 && Console.CursorLeft==7)
在C#=不用于两个值的比较。为了在两个值之间进行比较,你需要在你的语句中加上==。
if (Console.CursorTop**==**3 && Console.CursorLeft==7) {
Console.WriteLine();
}
问 - 已回答(在大约15秒钟内) – ChristopheD 2012-04-27 20:44:11
一个等号是一个赋值运算符,二是一个等号运算符。 – Polynomial 2012-04-27 20:44:24
C#你再次用你的==做了,我知道这很有道理,但我的大脑想要写出一个。总是给我造成麻烦=) – Coops 2013-05-03 11:12:13