作者james732 (好人超)
站内C_Sharp
标题Re: [问题] 能帮我看这小段程式码在做什麽
时间Sun May 9 01:55:11 2010
※ 引述《motestt60279 (狐狸在做什麽)》之铭言:
if (how == 1)
{
if (str == "")
{
str = "0";
};
all += Convert.ToDouble(str);
}
else if (how == 2)
{
if (str == "")
{
str = "0";
};
all -= Convert.ToDouble(str);
}
else if (how == 3)
{
if (str == "")
{
str = "1";
};
all *= Convert.ToDouble(str);
}
else if (how == 4)
{
if (str == "")
{
str = "1";
};
all /= Convert.ToDouble(str);
}
else if (how == 0)
{
if (str == "")
{
str = "0";
}
all = Convert.ToDouble(str);
}
美观端正的排版有益健康,整理一下,整个逻辑就很好懂了
至於 if (...) { }
; 那个分号
应该只是会多产生一个 empty statement
就像这样的程式是合法的...XD
class Program
{
static void Main(string[] args)
{
; ; ; ; ; ;
}
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.117.171.46
1F:推 motestt60279:感谢欧 的确 排的有点乱 看的雾煞煞 05/09 16:48