// s14ad Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; namespace NagDotNetExamples { public class S14ADE { static string datafile = "ExampleData/s14ade.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { PrintManager.Warning = new PrintManager.MessageLogger(discardmessage); DataReader sr = new DataReader(datafile); double x = 0.0; int i, m, n; int ifail; Console.WriteLine("s14ad Example Program Results"); // Skip heading in data file sr.Reset(); Console.WriteLine(""); Console.WriteLine(" {0} {1}", " x ans[0] ans[1] ", " ans[2] ans[3] ifail"); Console.WriteLine(""); n = 0; m = 4; double[] ans = new double[m]; try { while (true) { sr.Reset(); x = double.Parse(sr.Next(), CultureInfo.InvariantCulture); // S.s14ad(x, n, m, ans, out ifail); // if (ifail >= 0) { Console.Write(" {0:0.0000E+00}", x); for (i = 1; i <= m; i++) { Console.Write("\t {0:0.####E+00}", ans[i - 1]); } Console.WriteLine("{0,7}", ifail); } else { Console.WriteLine("** s14ad failed with ifail = {0,5}", ifail); } } } catch { } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine("Exception Raised"); } } static void discardmessage(String message) { } } }