public static void Main(string[] args) { Console.WriteLine("\nIntStream"); IntStream inst = new IntStream(); Console.WriteLine(inst.next1()); Console.WriteLine(inst.next1()); Console.WriteLine(inst.next1()); Console.WriteLine(inst.next1()); Console.WriteLine(inst.eos()); inst.reset(); Console.WriteLine(inst.next1()); Console.WriteLine("\nPrimeStream"); PrimeStream ps = new PrimeStream(); Console.WriteLine(ps.next1()); Console.WriteLine(ps.next1()); Console.WriteLine(ps.next1()); Console.WriteLine(ps.next1()); Console.WriteLine(ps.eos()); ps.reset(); Console.WriteLine(ps.next1()); Console.WriteLine("\nRandomStream"); RandomStream rs = new RandomStream(); Console.WriteLine(rs.next1()); Console.WriteLine(rs.next1()); Console.WriteLine(rs.next1()); Console.WriteLine(rs.next1()); Console.WriteLine(rs.eos()); rs.reset(); Console.WriteLine(rs.next1()); Console.WriteLine("\nRandomWordStream"); RandomWordStream rws = new RandomWordStream(); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); Console.WriteLine(rws.eos()); rws.reset(); Console.WriteLine(rws.next()); Console.ReadKey(); }
public static void Main(string[] args) { IntStream intS = new IntStream(); Console.WriteLine("Int stream: "); Console.WriteLine(intS.next()); Console.WriteLine(intS.next()); Console.WriteLine(intS.next()); Console.WriteLine(intS.eos()); intS.reset(); Console.WriteLine(intS.next()); Console.WriteLine("Prime stream: "); PrimeStream primeS = new PrimeStream(); Console.WriteLine(primeS.next()); Console.WriteLine(primeS.next()); Console.WriteLine(primeS.next()); Console.WriteLine(primeS.eos()); primeS.reset(); Console.WriteLine(primeS.next()); RandomStream randomS = new RandomStream(); Console.WriteLine("Random stream: "); Console.WriteLine(randomS.next()); Console.WriteLine(randomS.next()); Console.WriteLine(randomS.next()); Console.WriteLine(randomS.eos()); primeS.reset(); Console.WriteLine(randomS.next()); RandomWordStream rws = new RandomWordStream(); Console.WriteLine("Random Word Stream: "); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); Console.WriteLine(rws.next()); }
static void Main(string[] args) { IntStream liczba = new IntStream(); PrimeStream liczba_pierwsza = new PrimeStream(); RandomStream losowa_liczba = new RandomStream(); RandomWordStream losowy_napis = new RandomWordStream(); int ilosc_stringow = 8; for (int i = 0; i < ilosc_stringow; i++) { Console.WriteLine("{0} Liczba znakow: {1}", losowy_napis.next(), liczba_pierwsza.next()); } }
static void Main( ) { { Console.WriteLine("Dziesięć pierwszych liczb naturalnych:"); IntStream is_ = new IntStream( ); for (int i = 0; i < 10; i++) { Console.Write(is_.next( )); Console.Write(" "); } Console.WriteLine("\n"); } { Console.WriteLine("Dziesięć pierwszych liczb pierwszych:"); PrimeStream ps = new PrimeStream( ); for (int i = 0; i < 10; i++) { Console.Write(ps.next( )); Console.Write(" "); } Console.WriteLine("\n"); } { Console.WriteLine("Dziesięć losowych stringów o długościach równym kolejnym liczbą pierwszym:"); RandomWordStream rs = new RandomWordStream( ); for (int i = 0; i < 10; i++) { Console.WriteLine(rs.next( )); } } }
static void Main(string[] args) { RandomWordStream rws = new RandomWordStream(); Console.WriteLine("Opcje:"); Console.WriteLine("1 -- Wypisuje string"); Console.WriteLine("2 -- Sprawdza, czy strumień się zakończył"); Console.WriteLine("3 -- Resetuje strumień"); Console.WriteLine("cokolwiek innego -- Kończy program"); bool done = false; while (!done) { int option = int.Parse(Console.ReadLine()); switch (option) { case 1: Console.WriteLine(rws.next()); break; case 2: Console.WriteLine("EOS = {0}", rws.eos() ? "true" : "false"); break; case 3: rws.reset(); Console.WriteLine("Zresetowano strumień"); break; default: done = true; break; } } }