示例#1
0
        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());
            }
        }
示例#2
0
        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();
        }
示例#3
0
        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( ));
                }
            }
        }
示例#4
0
        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());
        }
示例#5
0
 public RandomWordStream()
 {
     length = new IntStream();
     length.next();
     rnd = new RandomStream();
 }