我有一个计算多个数的阶乘的程序。这些量拟合选取在CMD作为参数传递这样:C#分离参数参数
factorial.exe 3 4 5
这将分别计算的3,4和5中的阶乘。 程序的早期版本有一个百分比显示堆栈的完整性。我想提出的是回来了,但我也打发等待时间在CMD参数为这样的:
factorial.exe 3 4 5 wait_time1
或
factorial.exe 3 4 5 1000
读书,我用这个ARGS解析器的数字:
static string the_time;
public static void Main(string[] args)
{
foreach (string s in args)
{
extra = int.Parse(s);
Calculate(extra);
}
}
如何区分参数? 在此先感谢。
这里我们有一个完整的答案=)+1 – 2012-08-02 07:12:33