Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.CSharp;
- using BleachArgParse;
- using System;
- namespace BleachArgParseExample {
- class BleachArgParseExampleprogram {
- static void Main(string[] arguments) {
- StartTest();
- Console.WriteLine("nThe program has finished, press any key to continue...");
- Console.ReadKey();
- }
- private static void StartTest() {
- ArgumentParser parser = new ArgumentParser();
- parser.description = "Calculates the volume of a cylinder.";
- parser.include_help = true;
- parser.name_prefix = "--";
- parser.short_prefix = "-";
- parser.AddArgument("radius", "The radius of the cylinder.", "r", true, type:ArgumentType.Double);
- parser.AddArgument("height", "The height of the cylinder.", "h", true, type:ArgumentType.Double);
- var args = parser.ParseArguments();
- var x = Calculate(args.radius, args.height);
- Console.WriteLine(x);
- }
- private static double Calculate(double radius, double height) {
- return (Math.PI) * (radius * radius) * height;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement