细微漫步,处处留痕,你的世界,我的眼光.何年何月永远不变.
发布新日志
-
2008-05-06 20:43:33
namespace MyStack
{
public class MyStack
{
private int nextIndex;
private string[] elements(元素);
public static void Main(string[] args)
{
}
public MyStack()
{
elements = new string[100];
nextIndex = 0;
}
public void Push(string element)
{
elements[nextIndex++] = element;
}
public string Pop()
{
return elements[--nextIndex];
}
public void Delete(int n)
{
nextIndex = nextIndex - n;
}
public string Top()
{
return elements[nextIndex-1];
}
public int Size()
{
return this.nextIndex;
}
}
}
查看(391)
评论(1)
收藏
分享
管理