Ejemplo n.º 1
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);
    }
Ejemplo n.º 2
0
    static void Main()
    {
        IntStream         strumNaturalny           = new IntStream();
        PrimeStream       strumPierwszych          = new PrimeStream();
        RandomStream      strumRandomowych         = new RandomStream();
        RandomWorldStream strumRandomowychStringow = new RandomWorldStream();

        Console.Write("Kolejna liczba naturalna: {0} \n", strumNaturalny.next());
        Console.Write("Kolejna liczba naturalna: {0} \n", strumNaturalny.next());
        Console.Write("Kolejna liczba naturalna: {0} \n", strumNaturalny.next());
        Console.Write("Reset strumienia.\n");
        strumNaturalny.reset();
        Console.Write("Kolejna liczba naturalna: {0} \n", strumNaturalny.next());
        Console.Write("Kolejna liczba naturalna: {0} \n", strumNaturalny.next());
        if (strumNaturalny.eos() == false)
        {
            Console.Write("\tStan eos: falsz.\n");
        }
        else
        {
            Console.Write("\tStan eos: prawda.\n");
        }
        Console.Write("Kolejna liczba pierwsza: {0} \n", strumPierwszych.next());
        Console.Write("Kolejna liczba pierwsza: {0} \n", strumPierwszych.next());
        Console.Write("Kolejna liczba pierwsza: {0} \n", strumPierwszych.next());
        Console.Write("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
        Console.WriteLine("Kolejna liczba losowa: {0} ", strumRandomowych.next());
        Console.WriteLine("Kolejna liczba losowa: {0}", strumRandomowych.next());
        Console.WriteLine("Kolejna liczba losowa: {0} ", strumRandomowych.next());
        Console.Write("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
        Console.Write("Kolejny losowy string: {0}\n", strumRandomowychStringow.nextL());
        Console.Write("Kolejny losowy string: {0}\n", strumRandomowychStringow.nextL());
        Console.Write("Kolejny losowy string: {0}\n", strumRandomowychStringow.nextL());
    }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
Archivo: zad1.cs Proyecto: 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));
        }
    }