public static void Main(string[] args)
    {
        IntStream test = new IntStream();

        Console.WriteLine("{0}", test.x);
        Console.WriteLine("{0}", test.next());
        Console.WriteLine("{0}", test.next());
        test.x = int.MaxValue;
        Console.WriteLine("{0}", test.eos());
        RandomStream tescik = new RandomStream();

        Console.WriteLine(tescik.x);
        tescik.reset();
        Console.WriteLine(tescik.x);
        Console.WriteLine(tescik.next());
        Console.WriteLine(tescik.eos());
        PrimeStream tescik2 = new PrimeStream();

        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine(tescik2.next());
        }

        RandomWordStream a = new RandomWordStream();

        for (int i = 0; i < 20; i++)
        {
            Console.WriteLine(a.next());
        }
    }
    public static void Main()
    {
        IntStream        stream = new IntStream();
        PrimeStream      prime  = new PrimeStream();
        RandomStream     rand   = new RandomStream();
        RandomWordStream word   = new RandomWordStream();

        Console.WriteLine("Next z klasy IntStream");
        for (int i = 0; i <= 5; i++)
        {
            Console.WriteLine(stream.next());
        }
        Console.WriteLine("Next z klasy PrimeStream");
        for (int i = 0; i <= 5; i++)
        {
            Console.WriteLine(prime.next());
        }

        Console.WriteLine("Next z klasy RandomStream");
        for (int i = 0; i <= 5; i++)
        {
            Console.WriteLine(rand.next());
        }

        Console.WriteLine("Next z klasy RandomWordStream");
        for (int i = 0; i <= 5; i++)
        {
            Console.WriteLine(word.next());
        }
    }
Example #3
0
    public static void Main()
    {
        var primeStream  = new PrimeStream();
        var intStream    = new IntStream();
        var stringStream = new RandomWordStream();

        Console.WriteLine("How many strings do you want to generate?");
        Console.WriteLine("(Enter a number smaller than 1 to generate the entire stream)");
        var input = Console.ReadLine();
        int amount;

        if (!int.TryParse(input, out amount))
        {
            Console.WriteLine("Invalid input!");
            return;
        }

        if (amount <= 0)
        {
            while (!stringStream.Eos())
            {
                Console.WriteLine("{0}) {1} characters: {2}", intStream.Next(), primeStream.Next(), stringStream.Next());
            }
        }
        else
        {
            for (int i = intStream.Next(); i < amount; i++)
            {
                Console.WriteLine("{0}) {1} characters: {2}", intStream.Next(), primeStream.Next(), stringStream.Next());
            }
        }
    }
Example #4
0
    static void Main(string[] args)
    {
        //---------------------
        Console.WriteLine("[Testing RandomWordStream]");
        RandomWordStream rws = new RandomWordStream();

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine($" > {rws.next()} < ");
        }

        //---------------------
        Console.WriteLine("[Testing LazyList]");
        LazyList LL = new LazyList();

        Console.WriteLine($"LL> size:{LL.size()}");
        Console.WriteLine($"LL> [0]: {LL.element(0)}\tsize:{LL.size()}");
        Console.WriteLine($"LL> [0]: {LL.element(0)}\tsize:{LL.size()}");
        Console.WriteLine($"LL> [40]:{LL.element(40)}\tsize:{LL.size()}");
        Console.WriteLine($"LL> [38]:{LL.element(38)}\tsize:{LL.size()}");
        Console.WriteLine($"LL> [50]:{LL.element(50)}\tsize:{LL.size()}");
        Console.WriteLine($"LL> [38]:{LL.element(38)}\tsize:{LL.size()}");

        //---------------------
        Console.WriteLine("[Testing PrimeLazyList]");
        LazyList PLL = new PrimeLazyList();

        Console.WriteLine($"PLL> size:{PLL.size()}");
        Console.WriteLine($"PLL> [0]: {PLL.element(0)}\tsize:{PLL.size()}");
        Console.WriteLine($"PLL> [0]: {PLL.element(0)}\tsize:{PLL.size()}");
        Console.WriteLine($"PLL> [40]:{PLL.element(40)}\tsize:{PLL.size()}");
        Console.WriteLine($"PLL> [38]:{PLL.element(38)}\tsize:{PLL.size()}");
        Console.WriteLine($"PLL> [50]:{PLL.element(50)}\tsize:{PLL.size()}");
        Console.WriteLine($"PLL> [38]:{PLL.element(38)}\tsize:{PLL.size()}");
    }
Example #5
0
        static void Main()
        {
            IntStream a = new IntStream();

            System.Console.WriteLine(a.next());
            System.Console.WriteLine(a.next());
            System.Console.WriteLine();

            a.reset();
            System.Console.WriteLine(a.next());
            System.Console.WriteLine(a.next());
            System.Console.WriteLine();

            Primestream p = new Primestream();

            System.Console.WriteLine(p.next());
            System.Console.WriteLine(p.next());
            System.Console.WriteLine(p.next());
            System.Console.WriteLine(p.next());
            System.Console.WriteLine();

            RandomStream r = new RandomStream();

            System.Console.WriteLine(r.next());
            System.Console.WriteLine(r.next());
            System.Console.WriteLine(r.next());
            System.Console.WriteLine();

            RandomWordStream rs = new RandomWordStream();

            System.Console.WriteLine(rs.next());
            System.Console.WriteLine(rs.next());
            System.Console.WriteLine(rs.next());
            System.Console.Read();
        }
Example #6
0
    static void Main()
    {
        RandomWordStream slowa = new RandomWordStream();

        for (int i = 0; i < 6; i++)
        {
            Console.WriteLine(slowa.next());
        }
    }
Example #7
0
File: zad1.cs Project: rafpacut/ii
    public static void Main()
    {
        System.Console.WriteLine("IntStream");
        //IntStream
        IntStream iss = new IntStream();

        writeout(iss.next());
        writeout(iss.next());
        System.Console.WriteLine(iss.eos());
        iss.reset();
        System.Console.WriteLine(iss.eos());
        writeout(iss.next());

        while (!iss.eos())
        {
            iss.next();
        }
        System.Console.WriteLine("PrimeStream");


        //PrimeStream
        PrimeStream ps = new PrimeStream();

        for (int i = 0; i < 12; i++)
        {
            writeout(ps.next());
        }
        ps.reset();
        for (int i = 0; i < 12; i++)
        {
            writeout(ps.next());
        }
        System.Console.WriteLine("RandomStream");

        //RandomStream
        RandomStream rst = new RandomStream();

        writeout(rst.next());
        writeout(rst.next());
        writeout(rst.next());
        writeout(rst.next());

        System.Console.WriteLine("RandomWordStream");

        //RandomWordStream

        RandomWordStream rws = new RandomWordStream();
        RandomStream     rs1 = new RandomStream();
        PrimeStream      ps1 = new PrimeStream();

        for (int i = 0; i < 12; i++)
        {
            int prime = ps1.next();
            System.Console.WriteLine(rws.next(prime, rs1));
        }
    }
Example #8
0
    static void Main(string[] args)
    {
        RandomWordStream r = new RandomWordStream();

        for (int i = 0; i < 3; i++)
        {
            Console.WriteLine("{0}\n", r.next());
        }
        Console.WriteLine("Hello World! {0}", int.MaxValue);
    }
Example #9
0
    public static int Main()
    {
        RandomWordStream x = new RandomWordStream();

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(x.next());
        }
        return(0);
    }
Example #10
0
    static void Main(string[] args)
    {
        RandomStream ps = new RandomStream();

        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        RandomWordStream rws = new RandomWordStream();

        Console.WriteLine(rws.next());
        Console.WriteLine(rws.next());
        Console.WriteLine(rws.next());
    }
Example #11
0
    public static void Main()
    {
        RandomWordStream ps = new RandomWordStream();

        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
    }
    public static void Main()
    {
        RandomWordStream instrea = new RandomWordStream();

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(instrea.next());
        }
        Console.WriteLine(instrea.next());
        instrea.reset();
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(instrea.next());
        }
    }
Example #13
0
    static void Main()
    {
        int              i;
        PrimeStream      ps    = new PrimeStream();
        IntStream        ins   = new IntStream();
        RandomStream     rnd   = new RandomStream();
        RandomWordStream rndws = new RandomWordStream();

        Console.WriteLine(rnd.next());
        Console.WriteLine(rnd.next());
        Console.WriteLine(rnd.next());
        Console.WriteLine(ins.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());
        Console.WriteLine(ps.next());

        Console.WriteLine(rndws.next());
        Console.WriteLine(rndws.next());
        Console.WriteLine(rndws.next());

        rnd.reset();
        ins.reset();
        ins.next();
        for (i = 0; i < 10; i++)
        {
            Console.WriteLine("{0} losowa liczba: {1}", ins.next(), rnd.next());
        }

        rndws.reset();
        ps.reset();
        for (i = 0; i < 15; i++)
        {
            Console.WriteLine("slowo o dl = {0}: {1}", ps.next(), rndws.next());
        }
        ps.reset();
        for (i = 0; i < 30; i++)
        {
            Console.WriteLine("{0} liczba pierwsza = {1}", i + 1, ps.next());
        }
        ins.reset();
        int p = 0;

        while (!ins.eos())
        {
            p = ins.next();
        }
        Console.WriteLine("najwieksza liczba typu int = {0}", p);
    }
Example #14
0
    public static void Main(string[] args)
    {
        IntStream intStream;

        intStream = new IntStream();

        Console.WriteLine("\nTesting IntStream: \n");

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(intStream.next());
        }

        Console.WriteLine("\nTesting PrimeStream: \n");
        PrimeStream primeStream;

        primeStream = new PrimeStream();

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(primeStream.next());
        }

        Console.WriteLine("\nTesting RandomStream: \n");
        RandomStream randomStream;

        randomStream = new RandomStream();

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(randomStream.next());
        }

        primeStream.reset();
        Console.WriteLine("\nTesting RandomWordStream: \n");
        RandomWordStream randomWordStream;

        randomWordStream = new RandomWordStream(randomStream, primeStream);

        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(randomWordStream.next());
        }
    }
Example #15
0
 public static int Main()
 {
     RandomWordStream x = new RandomWordStream();
     for(int i=0; i<10; i++)
         Console.WriteLine(x.next());
     return 0;
 }
Example #16
0
    static void Main()
    {
        int stan = 1;

        System.Console.WriteLine("Wybierz co chcesz zrobic:");
        System.Console.WriteLine("1.Kolejna liczba naturalna");
        System.Console.WriteLine("2.Wlacz/Wylacz strumien");
        System.Console.WriteLine("3.Sprawdz stan strumienia");
        System.Console.WriteLine("4.Reset");
        System.Console.WriteLine("5.Liczba losowa");
        System.Console.WriteLine("6.Kolejne liczby pierwsze");
        System.Console.WriteLine("7.Ciagi znakow o dlugosci liczb pierwszych");
        System.Console.WriteLine("8.Wyjscie");
        IntStream   instance        = new IntStream();
        PrimeStream prime           = new PrimeStream();
        PrimeStream primeForStrings = new PrimeStream();

        while (stan == 1)
        {
            string wybor = System.Console.ReadLine();
            switch (wybor)
            {
            case "1":
            {
                int liczba = instance.next();
                if (liczba == -1)
                {
                    System.Console.WriteLine("Strumien zamkniety");
                }
                else
                {
                    System.Console.WriteLine("Liczba naturalna: " + liczba);
                }
                break;
            }

            case "2":
            {
                bool eos = instance.endofstream;
                if (eos == true)
                {
                    instance.endofstream = false;
                }
                else
                {
                    instance.endofstream = true;
                }
                break;
            }

            case "3":
            {
                System.Console.WriteLine("Stan strumienia : " + instance.eos());
                break;
            }

            case "4":
            {
                instance = new IntStream();
                System.Console.WriteLine("Ustawienia zresetowane");
                break;
            }

            case "5":
            {
                RandomStream random = new RandomStream();
                if (instance.endofstream == false)
                {
                    System.Console.WriteLine("Liczba losowa:" + random.next());
                }
                else
                {
                    System.Console.WriteLine("Strumien zamkniety");
                }
                break;
            }

            case "6":
            {
                int wynik = prime.next();
                if (wynik == -1)
                {
                    instance.endofstream = true;
                    System.Console.WriteLine("Strumien zamkniety");
                }
                else
                {
                    System.Console.WriteLine("Kolejna Liczba Pierwsza " + wynik);
                }
                break;
            }

            case "7":
            {
                RandomWordStream ciag       = new RandomWordStream();
                string           rnd_string = ciag.next();
                System.Console.WriteLine("Losowy ciag znakow: " + rnd_string);
                break;
            }

            case "8":
            {
                stan = 0;
                break;
            }

            default:
            {
                System.Console.WriteLine("Bledny wybor");
                break;
            }
            }
        }
    }