nmnative 0 Newbie Poster

Aye Carumba,
I do believe I am on the right trail and have this finished correctly. The StackInheritanceLibrary.cs and LinkedListLibrary.cs are located here:
http://www.daniweb.com/forums/thread108670.html

If anyone can check this out and let me know if this is correct and is pushing and popping the random 10000, 100000, 1000000, and 10000000 numbers please let me know. I do believe this is the finished form.
Thank you

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using LinkedListLibrary;
using StackInheritanceLibrary;

namespace HW2_Corrected
{
    class Program
    {
        static void Main(string[] args)
        {
            StackInheritance stack = new StackInheritance();
            Stack myStack = new Stack();
            Random myrandom = new Random();

            DateTime start_SI = DateTime.Now;
            for (int i = 0; i < 10000; i++)
            {             
                stack.Push(myrandom.Next(10000));
                
            }
            for (int i = 0; i < 10000; i++)
            
            {
                stack.Pop();
            }

            DateTime end_SI = DateTime.Now;

            TimeSpan time_consumed_SI = end_SI.Subtract(start_SI);

            Console.WriteLine("Time to push 10,000 numbers in milliseconds by STACKINHERITANCE = " + time_consumed_SI.TotalMilliseconds);

//------------------------------------------------------------------------------------------------------------------------------------------

            DateTime start_SI1 = DateTime.Now;
            for (int i = 0; i < 100000; i++)
            {
                stack.Push(1);
                //Console.WriteLine("" + i);
            }

            {
                stack.Pop();
            }

            DateTime end_SI1 = DateTime.Now;

            TimeSpan time_consumed_SI1 = end_SI1.Subtract(start_SI1);

            Console.WriteLine("Time to push 100,000 numbers in milliseconds by STACKINHERITANCE = " + time_consumed_SI1.TotalMilliseconds);

//------------------------------------------------------------------------------------------------------------------------------------------
            DateTime start_SI2 = DateTime.Now;
            for (int i = 0; i < 1000000; i++)
            {
                stack.Push(1);
                //Console.WriteLine("" + i);
            }

            {
                stack.Pop();
            }

            DateTime end_SI2 = DateTime.Now;

            TimeSpan time_consumed_SI2 = end_SI2.Subtract(start_SI2);

            Console.WriteLine("Time to push 1,000,000 numbers in milliseconds by STACKINHERITANCE = " + time_consumed_SI2.TotalMilliseconds);

//------------------------------------------------------------------------------------------------------------------------------------------
            DateTime start_SI3 = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                stack.Push(1);
                //Console.WriteLine("" + i);
            }

            {
                stack.Pop();
            }

            DateTime end_SI3 = DateTime.Now;

            TimeSpan time_consumed_SI3 = end_SI3.Subtract(start_SI3);

            Console.WriteLine("Time to push 10,000,000 numbers in milliseconds by STACKINHERITANCE = " + time_consumed_SI3.TotalMilliseconds);
//------------------------------------------------------------------------------------------------------------------------------------------
            DateTime start_SL = DateTime.Now;

            for (int i = 0; i < 10000; i++)
            {
                myStack.Push(1);
                //Console.WriteLine("" + i);

            }

            {
                myStack.Pop();

            }
            DateTime end_SL = DateTime.Now;

            TimeSpan time_consumed_SL = end_SL.Subtract(start_SL);

            Console.WriteLine("Time to push elements via STACKLIST = " + time_consumed_SL.TotalMilliseconds);
 //---------------------------------------------------------------------------------------------------------------------------------------- 
            DateTime start_SL1 = DateTime.Now;

            for (int i = 0; i < 100000; i++)
            {
                myStack.Push(1);
                //Console.WriteLine("" + i);

            }

            {
                myStack.Pop();

            }
            DateTime end_SL1 = DateTime.Now;

            TimeSpan time_consumed_SL1 = end_SL1.Subtract(start_SL1);

            Console.WriteLine("Time to push elements via STACKLIST = " + time_consumed_SL1.TotalMilliseconds);
//---------------------------------------------------------------------------------------------------------------------------------------- 
            DateTime start_SL2 = DateTime.Now;

            for (int i = 0; i < 1000000; i++)
            {
                myStack.Push(1);
                //Console.WriteLine("" + i);

            }

            {
                myStack.Pop();

            }
            DateTime end_SL2 = DateTime.Now;

            TimeSpan time_consumed_SL2 = end_SL2.Subtract(start_SL2);

            Console.WriteLine("Time to push elements via STACKLIST = " + time_consumed_SL2.TotalMilliseconds);
//---------------------------------------------------------------------------------------------------------------------------------------- 
            DateTime start_SL3 = DateTime.Now;

            for (int i = 0; i < 10000000; i++)
            {
                myStack.Push(1);
                //Console.WriteLine("" + i);

            }

            {
                myStack.Pop();

            }
            DateTime end_SL3 = DateTime.Now;

            TimeSpan time_consumed_SL3 = end_SL3.Subtract(start_SL3);

            Console.WriteLine("Time to push elements via STACKLIST = " + time_consumed_SL3.TotalMilliseconds);
 //---------------------------------------------------------------------------------------------------------------------------------------- 

        
        }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.