sequence/2/App.cs - An application of the integer sequences. | Lecture 12 - slide 35 : 36 Program 7 |
using System; class SeqApp { public static void Main(){ IntSequence isq1 = new IntCompSeq( new IntCompSeq( new IntInterval(3,5), new IntSingular(17) ), new IntCompSeq( new IntInterval(12,7), new IntSingular(29) ) ); IntSequence isq2 = new IntCompSeq( new IntCompSeq( new IntInterval(3,3), new IntCompSeq(new IntInterval(1,5), new IntInterval(15,20))), new IntCompSeq( new IntCompSeq(new IntInterval(-1,-5), new IntInterval(-15,-20)), new IntInterval(12,7))); Console.WriteLine("Min: {0} Max: {1}", isq1.Min, isq1.Max); Console.WriteLine("Min: {0} Max: {1}", isq2.Min, isq2.Max); foreach(int i in isq1) Console.Write("{0,4}", i); Console.WriteLine(); foreach(int i in isq2) Console.Write("{0,4}", i); } }