我想知道如何从窗体的控制台获取输入:
M 14 65 99 in nemerle.在C#中,我这样做:
string[] input = System.Console.ReadLine().Split(' ');
ch = System.Char.Parse(input[0]);
a = System.Int32.Parse(input[1]);
d = System.Int32.Parse(input[2]);
m = System.Int32.Parse(input[3]);
Run Code Online (Sandbox Code Playgroud)
但这并不适用于Nemerle.请建议我如何在Nemerle做.
class Test
{
public static Main () : void
{
def input = System.Console.ReadLine ().Split (' ');
def ch = System.Char.Parse (input[0]);
def a = System.Int32.Parse (input[1]);
def d = System.Int32.Parse (input[2]);
def m = System.Int32.Parse (input[3]);
System.Console.WriteLine ("ch:{0} a:{1} d:{2} m:{3}", ch, a, d, m);
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
309 次 |
最近记录: |