// g01dd Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01DDE { static string datafile = "ExampleData/g01dde.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); double pw, w; int i, j, n; bool calwts = false; int ifail; Console.WriteLine("g01dd Example Program Results"); // Skip heading in data file sr.Reset(); calwts = true; sr.Reset(); n = int.Parse(sr.Next()); double[] a = new double[n]; double[] x = new double[n]; if (n > 0 ) { for (j = 1; j <= 2; j++) { sr.Reset(); for (i = 1; i <= n; i++) { x[i - 1] = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } Array.Sort(x); // G01.g01dd(x, n, calwts, a, out w, out pw, out ifail); // if (ifail != 0) { Console.WriteLine(""); Console.WriteLine("** g01dd failed with ifail = {0,5}", ifail); return; } // Console.WriteLine(""); Console.WriteLine(" {0}{1,1}{2}{3,7:f4}", "For sample number ", j, ", value of W statistic = ", w); Console.WriteLine(" {0}{1,8:f4}", " Significance level is ", pw); calwts = false; } } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }