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