// g01bj Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01BJE { static string datafile = "ExampleData/g01bje.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 p, peqk, pgtk, plek; int k, n; int ifail; Console.WriteLine("g01bj Example Program Results"); // Skip heading in data file sr.Reset(); Console.WriteLine(""); Console.WriteLine(" {0}", " N P K PLEK PGTK PEQK"); Console.WriteLine(""); L20: ; try { sr.Reset(); n = int.Parse(sr.Next()); p = double.Parse(sr.Next(), CultureInfo.InvariantCulture); k = int.Parse(sr.Next()); } catch { goto L40; } // G01.g01bj(n, p, k, out plek, out pgtk, out peqk, out ifail); // if (ifail == 0) { // Console.WriteLine(" {0,4}{1,8:f3}{2,5}{3,10:f5}{4,10:f5}{5,10:f5}", n, p, k, plek, pgtk, peqk); goto L20; } else { Console.WriteLine("** g01bj failed with ifail = {0,5}", ifail); } L40: ; // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }