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