第二个。。
using System;
class Stack
{
private Node first=null;
public bool Empty()
{
return (first==null);
}
public object Pop()
{
if(first==null)
throw new Exception("Cann't Pop from an empty Stack.");
else
{
object temp=first.Value;
first=first.Next;
return temp;
}
}
public void Push(object o)
{
first=new Node(o,first);
}
public void Push(object o1,object o2)
{
Push(o1);
Push(o2);
}
}
class Node
{
public Node Next;
public object Value;
public Node(object value)
{
Value=value;
Next=null;
}
public Node(object value, Node next)
{
Next=next;
Value=value;
}
}
class Test
{
public static void Main()
{
Stack s=new Stack();
for(int i=0;i<10;i++)
{
s.Push(i);
}
s.Push(-10,-20);
while(!s.Empty()
{
Console.WriteLine(s.Pop());
}
}
}
class Stack
{
private Node first=null;
public bool Empty()
{
return (first==null);
}
public object Pop()
{
if(first==null)
throw new Exception("Cann't Pop from an empty Stack.");
else
{
object temp=first.Value;
first=first.Next;
return temp;
}
}
public void Push(object o)
{
first=new Node(o,first);
}
public void Push(object o1,object o2)
{
Push(o1);
Push(o2);
}
}
class Node
{
public Node Next;
public object Value;
public Node(object value)
{
Value=value;
Next=null;
}
public Node(object value, Node next)
{
Next=next;
Value=value;
}
}
class Test
{
public static void Main()
{
Stack s=new Stack();
for(int i=0;i<10;i++)
{
s.Push(i);
}
s.Push(-10,-20);
while(!s.Empty()
{
Console.WriteLine(s.Pop());
}
}
}
And you are here, now, always.
People are not memories that you can put into words. They live.