作者: sckds 時間: 2008-11-17 23:06 標題: C# 錯咩 ? [solved]
static void Main(string[] args)
{
Console.WriteLine("The first 20 terms of the Fibonacci sequence:");
string numbers="1\t1\t";
int count = 2;
int pre2 = 1;
int pre1 = 1;
while (count < 20)
{
count++;
int nextnumber = pre1 + pre2;
if (count % 10 == 0)
{
numbers += nextnumber + "\t\n";
}
else
{
numbers += nextnumber + "\t";
}
int newper2 = per1;
int newper1 = nextnumber;
per2 = newper2;
per1 = newper1;
}
Console.WriteLine(numbers);
}
========================
紅色 error
[ 本帖最後由 sckds 於 2008-11-18 12:53 編輯 ]
作者: alextamly 時間: 2008-11-18 00:02
上面..pre1,pre2..
下面..per1,per2..
你話呢...

註..我唔識c#..錯左...隨便插..
作者: laputafish 時間: 2008-11-18 00:34
果句 error 應該講左畀你聽嘜野問題.
要學下睇佢個 error 訊息, 因為 debug 係要靠佢d error 訊息搵出黎.
下下一錯左, 淨係睇 code, 有時會 R 晒頭.
作者: sckds 時間: 2008-11-18 12:52
上面..pre1,pre2..
下面..per1,per2..
你話呢...
註..我唔識c#..錯左...隨便插..
not this problem
果句 error 應該講左畀你聽嘜野問題.
要學下睇佢個 error 訊息, 因為 debug 係要靠佢d error 訊息搵出黎.
下下一錯左, 淨係睇 code, 有時會 R 晒頭.
if i understand it , why i still ask
anyway, i solve the problem myself la
作者: alphaau 時間: 2008-11-18 14:11
響loop入面declare variable???
咁你想佢行一次declare 一次牙
作者: sckds 時間: 2008-11-18 18:37
why not ?
but it is not the main problem
the problem is naming

