// g01eb Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01EBE { static string datafile = "ExampleData/g01ebe.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 df, prob, t; string tail; int ifail; bool carryon = true; Console.WriteLine("g01eb Example Program Results"); // Skip heading in data file Console.WriteLine(""); Console.WriteLine(" {0}", " T DF PROB TAIL"); Console.WriteLine(""); sr.Reset(); while (carryon) { try { sr.Reset(); t = double.Parse(sr.Next(), CultureInfo.InvariantCulture); df = double.Parse(sr.Next(), CultureInfo.InvariantCulture); tail = sr.Next(); } catch { break; } // prob = G01.g01eb(tail, t, df, out ifail); // if (ifail == 0) { Console.WriteLine(" {0,6:f3}{1,8:f3}{2,8:f4} {3,1}", t, df, prob, tail); } else { Console.WriteLine("** g01eb failed with ifail = {0,5}", ifail); break; } } } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }