// g01ey Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01EYE { static string datafile = "ExampleData/g01eye.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 d, prob; int n; int ifail; bool carryon = true; Console.WriteLine("g01ey Example Program Results"); Console.WriteLine(""); Console.WriteLine(" {0}", " D N One-sided probability"); Console.WriteLine(""); // Skip heading in data file sr.Reset(); while (carryon) { try { sr.Reset(); n = int.Parse(sr.Next()); d = double.Parse(sr.Next(), CultureInfo.InvariantCulture); } catch { break; } // prob = G01.g01ey(n, d, out ifail); // if (ifail == 0) { Console.WriteLine(" {0,7:f4} {1,4} {2,7:f4}", d, n, prob); continue; } else { Console.WriteLine("** g01ey failed with ifail = {0,5}", ifail); break; } // } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }