English 中文(简体)
阅读单一用户投入线的多种变量/共同点
原标题:Reading multiple variables/commands from a single line of user input

www.un.或g/spanish/ecosoc 问题: 你们如何从单一用户投入线阅读多个指挥/记录/记录。

如同指挥部等任何中央领导机构一样,用户进入单一线,阅读和分配变数+商。

E.G. 转换方案指挥:

32 km to cm

之后,案文是:

numToConvert = (32)

当时

"km to cm"

转换点 汇率

 conversionRate1 = (0.621371192)

按换算率分列的32倍(0.621371192)

印刷结果。

第二例:

shutdown -h

shutdown /?

关闭改为指挥

-h modifies it 或 /? modifies it

最佳回答

在指挥线上,在节目名称之后,任何节目均分在白天空,并投到各代。

因此:

class Program
{
    static void Main(string[] args)
    {
        foreach (var a in args)
        {
            Console.WriteLine(a);
        }
    }
}

运行“c:>program.exe换算为 bar”,将产生线以下。

convert
foo
to
bar

为了消除语气的含义,你需要扫描机阵列,并寻找 mo。

如果你听起来严格,你就可以简单地看待预期的立场。

var numToConvert = Convert.toint32(args[4])

如果你重新允许灵活的辛迪加,那将更加复杂;你将需要制定一系列平级规则,帮助你了解投入。

问题回答

此外,你可能希望看到一个图书馆,旨在帮助教区和管理指挥线论点。 “指挥线”图书馆是一个很好的选择。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签