// g01al Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01ALE { static string datafile = "ExampleData/g01ale.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); int i, n; double[] res = new double[5]; int ifail; Console.WriteLine("g01al Example Program Results"); // Skip heading in data file sr.Reset(); sr.Reset(); n = int.Parse(sr.Next()); double[] x = new double[n]; for (i = 1; i <= n; i++) { x[i - 1] = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } // G01.g01al(n, x, res, out ifail); // if (ifail == 0) { // Console.WriteLine(""); Console.WriteLine(" {0}{1,16:f4}", "Maximum ", res[4]); Console.WriteLine(" {0}{1,16:f4}", "Upper Hinge ", res[3]); Console.WriteLine(" {0}{1,16:f4}", "Median ", res[2]); Console.WriteLine(" {0}{1,16:f4}", "Lower Hinge ", res[1]); Console.WriteLine(" {0}{1,16:f4}", "Minimum ", res[0]); } else { Console.WriteLine(""); Console.WriteLine("** g01al failed with ifail = {0,5}", ifail); } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }