Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using Microsoft.CSharp;
  2. using BleachArgParse;
  3. using System;
  4.  
  5. namespace BleachArgParseExample {
  6. class BleachArgParseExampleprogram {
  7. static void Main(string[] arguments) {
  8. StartTest();
  9. Console.WriteLine("nThe program has finished, press any key to continue...");
  10. Console.ReadKey();
  11. }
  12.  
  13. private static void StartTest() {
  14. ArgumentParser parser = new ArgumentParser();
  15.  
  16. parser.description = "Calculates the volume of a cylinder.";
  17. parser.include_help = true;
  18. parser.name_prefix = "--";
  19. parser.short_prefix = "-";
  20.  
  21. parser.AddArgument("radius", "The radius of the cylinder.", "r", true, type:ArgumentType.Double);
  22. parser.AddArgument("height", "The height of the cylinder.", "h", true, type:ArgumentType.Double);
  23.  
  24. var args = parser.ParseArguments();
  25.  
  26. var x = Calculate(args.radius, args.height);
  27. Console.WriteLine(x);
  28. }
  29.  
  30. private static double Calculate(double radius, double height) {
  31. return (Math.PI) * (radius * radius) * height;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement